Expose an agent as an API
Any agent can be published as an HTTP endpoint so external systems invoke it
directly, without a workflow around it. In the Agents page, open the
agent and enable Exposition API; pick an authentication mode (none,
basic, or a dedicated header/API key backed by a credential — see
Manage credentials).
Each call runs as a durable run of the system workflow
agent-invoke.workflow.yaml, so the turn is audited like any run. The agent
keeps its eligible tools (eligibility is judged when the agent is saved:
control-flow, human-task and dynamic nodes are out; a sink needs its
manifest's agentTool opt-in; and a tool's required context must be composable
by the caller — i.e. registered context kinds). Ambient context is composed
opportunistically from the agent's inputs: any input matching a registered
kind's id field (e.g. patientId) becomes that kind's context for the whole
turn, tools included.
Plain JSON surface
POST /api/agents/<nodeTypeId>/invoke— body{ "inputs": { <port>: value } }, validated against the agent's typed input ports (400details each mismatch); answers{ "outputs": { <port>: value } }.GET /api/agents/<nodeTypeId>/schema— the derived request/response JSON Schemas.GET /api/openapi.json— the OpenAPI document covering every exposed agent (and every webhook). A non-exposed agent answers like an unknown one.
OpenAI-compatible surface
The same agents are also served behind the standard OpenAI API, so any OpenAI client works unchanged:
base_url = https://<host>/api/openai/v1
model = <nodeTypeId> # ex. agent.extraction-de-symptomes
api_key = <credential header value>
GET /modelslists the exposed agents.POST /chat/completionsmaps the lastusermessage onto the agent's inputs: verbatim text when the agent has a singleStringinput (conversational case), otherwise the message content must be a JSON object keyed by port names (types validated). The assistant content is the singleStringoutput verbatim, otherwise the JSON output record.stream: trueanswers one complete SSE chunk then[DONE].- Authentication reuses the agent's setting;
Authorization: Bearer <value>is accepted for header credentials (an OpenAI client cannot set a custom header name).
Where to see what's exposed
The Endpoints module lists every exposed agent with its invoke URL, its
base_url/model pair, its auth and its schema link — next to the inbound
webhooks.
Related
- Use an agent in a workflow — the same agents as graph nodes, tools included.
- Author an LLM agent — defining the agent in the first place.
- Trigger a workflow with a webhook — exposing a whole workflow instead of a single agent.
- Manage credentials — the
secret store behind
basic/header/Bearer auth.