chain-rdeveloper portal
build

svc-ai — API Routes

Auto-generated from source on 2026-10-30 15:00 UTC. Do not edit manually — run make spec to regenerate.


/agents · agents

Source: modules/svc-ai/app/routers/agent.py

MethodPathHandlerDescription
GET/agents/agentslist_agentsReturn all agent roles available in the system.
POST/agents/execute/streamexecute_streamStream an execution result token-by-token via Server-Sent Events.
POST/agents/execute/stream/resumeexecute_stream_resumeResume a HITL-interrupted graph execution and stream the remainder.
DELETE/agents/execute/threads/{thread_id}discard_paused_threadDrop a paused run's checkpoint without resuming it.
POST/agents/executeexecute_agentGeneric entrypoint used by other components (models, agents, graphs, pipelines).
POST/agents/graphexecute_graphRun a graph configuration and initial input.
POST/agents/analysisrun_analysisExecute the standard 'analysis' graph (planner → analyzer → validator).
POST/agents/ragrun_ragExecute the built-in RAG pipeline graph.
POST/agents/skillexecute_skillExecute a stored Skill as a dynamic multi-agent LangGraph.

POST /agents/execute/stream

Stream an execution result token-by-token via Server-Sent Events.

All execution types (model, agent, skill, graph, pipeline) are handled by the inference engine for the requested type. The SSE event format is uniform across all types:

data: {"type": "graphplan", "stages": [...]} data: {"type": "status", "message": "..."} data: {"type": "token", "token": "..."} data: {"type": "tokenreset", "workeragentslug": "..."} data: {"type": "toolcall", ...} data: {"type": "nodestart", ...} data: {"type": "node_end", ...} data: {"type": "citations", "citations": [...]} data: {"type": "done", "output": "...", "usage": {...}} data: {"type": "error", "message": "..."}

POST /agents/execute/stream/resume

Resume a HITL-interrupted graph execution and stream the remainder.

The client sends this after receiving a `hitl_interrupt SSE frame. The graph is rebuilt from the same spec, then resumed via Command(resume={approved, feedback}) against the saved checkpoint. SSE frames are identical to the initial stream, ending with a done` frame.

DELETE /agents/execute/threads/{thread_id}

Drop a paused run's checkpoint without resuming it.

Checkpoints are kept in-process so a paused run can resume; one whose caller cancelled it, or gave up waiting, would otherwise stay for good.


/agents · agent-setup

Source: modules/svc-ai/app/routers/agent_setup.py

MethodPathHandlerDescription

/documents · documents

Source: modules/svc-ai/app/routers/documents.py

MethodPathHandlerDescription

/execute · execute

Source: modules/svc-ai/app/routers/execute.py

MethodPathHandlerDescription

/ · health

Source: modules/svc-ai/app/routers/health.py

MethodPathHandlerDescription

/knowledge · knowledge

Source: modules/svc-ai/app/routers/knowledge.py

MethodPathHandlerDescription
POST/knowledge/retrieveretrieveRun the retrieval pipeline over the given knowledge bases.
GET/knowledge/embeddingembedding_identityThe deployment's active embedding model.
POST/knowledge/embedembedEmbed texts with the deployment's embedding model (batched, ordered).
POST/knowledge/web/fetchweb_fetchFetch one page of a website knowledge source.
POST/knowledge/web/documentweb_documentDownload one document for a file knowledge source — a PDF or an
POST/knowledge/web/faviconweb_faviconA site's icon, fetched by the platform so the user's browser never asks

GET /knowledge/node-types

Return all built-in knowledge graph node type definitions.

Each definition includes a property_schema that describes the fields available for that entity type, used by the frontend to render schema-driven property editing forms.

POST /knowledge/retrieve

Run the retrieval pipeline over the given knowledge bases.

Returns ranked passages (with document / page / chunk provenance), graph facts, the rendered Markdown context an agent would receive, and the machine-readable citation list. Traced: the query embeddings, and the planning and reranking calls when a model is given.

GET /knowledge/embedding

The deployment's active embedding model.

svc-core sizes its collections by it and stamps them with its key.

POST /knowledge/embed

Embed texts with the deployment's embedding model (batched, ordered).

Traced against the embedding model, one row per request.

POST /knowledge/web/fetch

Fetch one page of a website knowledge source.

Always 200: a page that could not be read is a result the crawl records (`status` says why), not a failure of this call.

POST /knowledge/web/document

Download one document for a file knowledge source — a PDF or an office or text document, never a page (`knowledge/web.fetch_document`).

The bytes come back as they are, with where they came from in headers (percent-encoded: a header is ASCII). A document that could not be had is a 422 saying why, safe to show beside the URL.

POST /knowledge/web/favicon

A site's icon, fetched by the platform so the user's browser never asks a third party (knowledge/favicon.py). svc-core caches the result.


/knowledge · knowledge-setup

Source: modules/svc-ai/app/routers/knowledge_setup.py

MethodPathHandlerDescription
POST/knowledge/discover/planplan_discoveryThe web searches that would find the material (discovery's one model
POST/knowledge/discover/searchsearch_discoveryRun a plan's searches (no model). Each search is recorded as a
POST/knowledge/discover/checkcheck_discoveryProbe what the searches found (no model): robots.txt, the public https
POST/knowledge/discover/assignassign_sourcesFill the given sources with checked candidates, by handle (one model

POST /knowledge/discover/plan

The web searches that would find the material (discovery's one model call). A 422 says why none could be planned.

POST /knowledge/discover/search

Run a plan's searches (no model). Each search is recorded as a `web_search` tool invocation, as an agent's is.

POST /knowledge/discover/check

Probe what the searches found (no model): robots.txt, the public https guard, what each address is. In the order asked.

POST /knowledge/discover/assign

Fill the given sources with checked candidates, by handle (one model call). With no candidates there is nothing to choose, and no call.


/mcp · MCP Servers

Source: modules/svc-ai/app/routers/mcp.py

MethodPathHandlerDescription
POST/mcp/servers/probeprobe_serverConnect to an MCP server descriptor and return its exposed tools.

POST /mcp/servers/probe

Connect to an MCP server descriptor and return its exposed tools.

Never raises for a bad/unreachable server — the failure reason comes back in `error so svc-core can surface it to the user verbatim. The connection is bounded by mcp_connect_timeout_s` and the same transport policy (stdio allowlist, URL validation) as agent execution.


/memory · memory

Source: modules/svc-ai/app/routers/memory.py

MethodPathHandlerDescription
GET/memorylist_user_memoryEverything any agent remembers from one user's conversations.
DELETE/memorydelete_user_memoryDelete everything any agent remembers of one person — what svc-core
GET/memory/{agent_id}list_agent_memory
DELETE/memory/{agent_id}/{memory_id}delete_memory_entry
DELETE/memory/{agent_id}clear_agent_memory

GET /memory/summary

How much each agent remembers, from which conversations.

Read by svc-core's network views: one call for a whole fleet, rather than listing every agent's entries to count them. `recent` adds that many of each agent's newest entries, as a task line rather than the full text. Every requested agent is answered, with zeroes if it remembers nothing.

GET /memory

Everything any agent remembers from one user's conversations.

The user's data export reads this. Per agent would miss what a deleted agent still holds and what a shared agent (CHAINR Bot) remembers, and both are the user's. `user_id` is required: this route has no agent to narrow by, so without it it would return every user's memories.

DELETE /memory

Delete everything any agent remembers of one person — what svc-core calls when the person's account is deleted. `user_id` is required: without it this would delete every person's memories.


/models · models

Source: modules/svc-ai/app/routers/models.py

MethodPathHandlerDescription
POST/models/providerscreate_provider
PATCH/models/providers/{provider_id}update_provider
DELETE/models/providers/{provider_id}delete_providerDelete a provider that has never had a model.
GET/models/availablelist_available_modelsModels discoverable via LiteLLM for providers that are both registered
POST/models/validatevalidate_modelCheck whether a provider/model combination is usable:
GET/models/lookuplookup_modelResolve a model by its natural key (provider + model_name).
GET/modelslist_modelsThe catalogue. `include_archived` adds the models taken out of it —
POST/modelscreate_model
GET/models/{model_id}get_model
PATCH/models/{model_id}update_model
DELETE/models/{model_id}delete_modelTake a model out of the catalogue by archiving it.
POST/models/{model_id}/restorerestore_modelPut an archived model back in the catalogue, under the id it had.

DELETE /models/providers/{provider_id}

Delete a provider that has never had a model.

A provider with models — archived ones included — is refused: deleting it would delete them, and with them the catalogue record every trace and conversation on those models is linked to. Disable it instead.

GET /models/available

Models discoverable via LiteLLM for providers that are both registered in the DB (enabled) and have an API key in settings. Useful for populating a UI picker when adding new models.

POST /models/validate

Check whether a provider/model combination is usable:

  • Provider must exist in DB and be enabled.

  • Provider must have an API key in settings.

  • Model must appear in LiteLLM's known list for the provider.

GET /models/lookup

Resolve a model by its natural key (provider + model_name). Used by svc-core to fetch capability metadata without cross-DB FKs.

GET /models

The catalogue. `include_archived` adds the models taken out of it — for naming what old records ran on, never for choosing a model.

DELETE /models/{model_id}

Take a model out of the catalogue by archiving it.

The row is kept, so the traces, calls and conversations that used the model still name it; it disappears from every catalogue read, so nothing can select or run it. Archiving an archived model changes nothing.


/rules · rule-setup

Source: modules/svc-ai/app/routers/rules_setup.py

MethodPathHandlerDescription

/simulate · Simulation

Source: modules/svc-ai/app/routers/simulate.py

MethodPathHandlerDescription

POST /simulate/run

Run a simulation, traced as one invocation: its agents may each run on a different model, and every call names its own.


/skills · skill-setup

Source: modules/svc-ai/app/routers/skill_setup.py

MethodPathHandlerDescription

/skills · skills

Source: modules/svc-ai/app/routers/skills.py

MethodPathHandlerDescription
GET/skills/available/{name}get_available_skillReturn a single skill template by name.
GET/skills/agentslist_agent_definitionsList all worker agent definitions available for use in skill graphs.
GET/skills/agents/{name}get_agent_definitionFetch a single worker agent definition by name.
POST/skills/agentscreate_agent_definitionCreate a custom worker agent definition, optionally cloning a base.
PATCH/skills/agents/{name}update_agent_definitionUpdate a custom worker agent definition (builtins are immutable).
DELETE/skills/agents/{name}delete_agent_definitionDelete a custom worker agent definition (builtins are protected).

GET /skills/available

Return all built-in skill graph templates.

Each template includes:

  • Full node slot metadata (which agent definition sits at each node)

  • The ready-to-store graphdefinition (agentname refs, edges, start/end)

Clients use graph_definition as the `graph_definition` field when creating a Skill record in svc-core.

GET /skills/agents

List all worker agent definitions available for use in skill graphs.

Filterable by:

  • `role` — AgentRole value (e.g. "analyzer", "reviewer")

  • `tag` — Tag substring match

  • `is_builtin` — true = built-in only, false = custom only


/skillsets · skillset-setup

Source: modules/svc-ai/app/routers/skillset_setup.py

MethodPathHandlerDescription

/ · spend

Source: modules/svc-ai/app/routers/spend.py

MethodPathHandlerDescription

GET /spend

What model calls have cost this UTC day and calendar month, each ceiling, what is left and when it resets (`app.services.spend_guard`). svc-core's platform benchmark reads it before starting a run, so the benchmark never spends what people need.


/stats · stats

Source: modules/svc-ai/app/routers/stats.py

MethodPathHandlerDescription
GET/stats/turns/{core_invocation_id}get_turnThe model and tool calls behind one svc-core turn — an answer, a skill
GET/stats/tracesget_trace_statsReturn LLM and tool invocation counts with per-conversation avg ± stddev.
GET/stats/usageget_usage_statsReturn token usage aggregated from LLMInvocation records.
GET/stats/meterget_daily_meterEvery model call metered on one UTC day, summed by workspace, purpose,
POST/stats/stepsget_step_usageWhere a set of turns' tokens went: every model call they made, summed
GET/stats/web-search-domainsweb_search_domain_statsAggregate web_search result citations by source domain.

GET /stats/invocations

List individual LLM invocation traces, newest first.

Covers every recorded LLM call — conversation executions and platform flows such as generative agent setup alike. `user_id scopes the list to calls attributed to that user. offset pages past limit`, which is how the activity feed reaches calls older than its first page.

GET /stats/turns/{core_invocation_id}

The model and tool calls behind one svc-core turn — an answer, a skill run, an evaluation cell — by the id svc-core sent with it (`X-Invocation-Id; core_invocation_id on the rows). In the order they were made. user_id` narrows it to that person's rows, as every read here does; svc-core sends the turn's owner.

Turns from before the id was sent have no rows: an empty answer means "not recorded by turn", not "made no calls".

GET /stats/traces

Return LLM and tool invocation counts with per-conversation avg ± stddev. Provides both current-month and all-time totals. `user_id` scopes both to the traces attributed to that user; without it the figures cover the whole deployment.

GET /stats/usage

Return token usage aggregated from LLMInvocation records. Provides both current-month and all-time totals. `user_id` scopes both to the invocations attributed to that user; without it the figures cover the whole deployment.

GET /stats/meter

Every model call metered on one UTC day, summed by workspace, purpose, model and outcome — the deployment's whole spend, platform work included, for svc-core's daily economics export.

POST /stats/steps

Where a set of turns' tokens went: every model call they made, summed by graph node, step, pass and model. For svc-core's "where the tokens go" views, and the measurements that show what a change to the pipeline saved.

GET /stats/web-search-domains

Aggregate web_search result citations by source domain.

Reports how often each domain was surfaced in search results and its average trust/quality score (0.0-1.0, from the domain quality tiering applied when results were fetched). `user_id scopes the aggregation to a single user's tool calls; since/until` scope it to the tool calls whose invocation fell within that window.


/toolkits · toolkit-setup

Source: modules/svc-ai/app/routers/toolkit_setup.py

MethodPathHandlerDescription

/tools · tools

Source: modules/svc-ai/app/routers/tools.py

MethodPathHandlerDescription

GET /tools/available

Return all built-in tools with their category.

`category` is "general" for tools auto-injected into every agent and "specialist" for tools that must be explicitly configured. Sourced from the BUILTIN_TOOLS registry so the list stays in sync with registered implementations automatically.