Agents API
Configure AI agents with custom instructions, attach connectors, and grant access to organization credentials. The same endpoints power the in-app Agents settings.
What is an agent
An agent is a profile (name, description, system prompt, avatar) plus a set of allowed connectors and granted credentials. When you start a chat session with agent_id, the assistant runs under that profile and is restricted to the connectors and credentials you have explicitly granted.
Create an agent
Send a POST with the agent profile. All fields except name are optional.
List and get agents
Listing returns the system agent first, then your custom agents (paginated).
Update or delete
PATCH accepts a partial profile. DELETE is a soft delete — the system agent is read-only and rejects mutations with HTTP 400.
Allowed connectors
Use PUT .../connectors to set the full list of connector keys the agent is allowed to call (wildberries, ozon, telegram, …). Sending an empty array clears the list. Connectors define what tools the agent may use; credentials decide which accounts.
Available credentials
Returns every credential in the organization that matches the agent's allowed connectors, plus a granted flag indicating whether this agent already has access.
Grant a credential
Pick a credential_id from /available-credentials and grant it to the agent. Optional scopes narrow what parts of the credential the agent may use; revoke with DELETE /grants/{grant_id}.
Run a session under an agent
Pass agent_id in the POST /sessions/stream body. The call spawns the turn and returns 202 with its ids — read the reply over SSE as described in Streaming (SSE). The assistant uses the agent's system prompt and is limited to its granted connectors and credentials.
Available tools
Every tool the assistant can call inside an agent session. The set is fixed and applies to all agents — what differs per-agent is the system prompt and the connectors / credentials granted to it. Tool names are the function identifiers used in tool_call payloads.
Tool description structure
Every tool description is self-contained — no separate guidance layer. The model reads the description verbatim, so each one follows the same five-block structure:
- Purpose — one or two sentences: what the tool does and what it returns.
- When to use — concrete scenarios where this tool is the right pick.
- When NOT to use — boundaries that point to a specific alternative tool.
- Key constraints — prerequisites, formats, limits, ordering, and the error contract.
- Result interpretation — how to read the response, when to retry, when to stop.
Tool descriptors live in config/prompts/tools.yaml and follow this shape:
FAQ
What is an agent?
A profile (name, description, system prompt, avatar) plus a set of allowed connectors and granted credentials. Running a session with agent_id restricts the assistant to exactly those connectors and credentials.
What is the difference between allowed connectors and granted credentials?
Connectors define which tools the agent may use; credentials decide which accounts it acts on. Set connectors with PUT .../connectors and grant credentials chosen from /available-credentials.
How do I run a chat session under a specific agent?
Pass agent_id in the POST /sessions/stream body. The turn uses the agent's system prompt and is limited to its granted connectors and credentials; read the reply over SSE.
Can I edit or delete the built-in system agent?
No. The system agent is read-only and rejects mutations with HTTP 400. Your custom agents support PATCH (partial update) and DELETE (soft delete).
Frequently asked questions
What is an agent?
A profile (name, description, system prompt, avatar) plus a set of allowed connectors and granted credentials. Running a session with agent_id restricts the assistant to exactly those connectors and credentials.
What is the difference between allowed connectors and granted credentials?
Connectors define which tools the agent may use; credentials decide which accounts it acts on. Set connectors with PUT .../connectors and grant credentials chosen from /available-credentials.
How do I run a chat session under a specific agent?
Pass agent_id in the POST /sessions/stream body. The turn uses the agent's system prompt and is limited to its granted connectors and credentials; read the reply over SSE.
Can I edit or delete the built-in system agent?
No. The system agent is read-only and rejects mutations with HTTP 400. Your custom agents support PATCH (partial update) and DELETE (soft delete).