Skip to main content

Agents

Agents (also called bots) are the core resource in Brainstormer. Each agent has a name, AI model, system prompt, linked knowledge bases, and configuration for streaming, voice, file uploads, and multimodal support.
All API requests require a valid JWT token in the Authorization: Bearer <token> header. The API Gateway decodes the JWT and forwards auth context (user-id, organization-id, user-email, x-platform-role, x-org-role) as headers to downstream services.

Create Agent

Create a new agent in your organization.

Request Body

string
required
Agent name. 1-255 characters.
string
Agent description. Max 2000 characters.
string
AI model ID (e.g. openai/gpt-4o). If omitted, uses the platform default.
string
System prompt for the agent. Max 50,000 characters.
string[]
required
Array of knowledge base UUIDs to link to this agent. At least one knowledge base is required when publishing (isDraft: false).
boolean
default:"false"
If true, creates the agent as a draft. Draft agents do not need a linked knowledge base.
boolean
default:"true"
Enable streaming responses for chat.
boolean
default:"false"
Allow file uploads in chat.
boolean
default:"false"
Enable voice capabilities.
object
Voice configuration.
object
Multimodal input configuration.
object[]
Tool configurations for the agent.
object[]
Template variables for the system prompt.

Response (201)

boolean
Always true on success.
object
The created agent object.

Errors

error
Returned when isDraft is false and the agent has no linked knowledge bases, or none of the linked knowledge bases have indexed documents. The response includes:

List Agents

List all agents in your organization.

Query Parameters

number
default:"50"
Maximum number of agents to return.
number
default:"0"
Number of agents to skip for pagination.

Response (200)

object[]
Array of agent objects.
object
curl

Get Agent

Get a single agent by ID, including linked knowledge bases.

Path Parameters

string
required
Agent UUID.

Response (200)

Returns the full agent object plus:
object[]
Array of linked knowledge base objects with full details (name, description, document counts).
curl

Update Agent

Update an existing agent. All fields are optional — only provided fields are updated.

Path Parameters

string
required
Agent UUID.

Request Body

Same fields as Create Agent, but all are optional.
If you include knowledgeBaseIds, the entire set of linked KBs is replaced. Sending an empty array [] will unlink all knowledge bases.

Response (200)

Returns the updated agent object.

Errors

error
Returned when isDraft is set to false and the agent has no linked knowledge bases, or none of the linked knowledge bases have indexed documents yet.
curl

Delete Agent

Soft-delete an agent (sets deleted_at; conversations are retained). The agent stops appearing in active listings.

Path Parameters

string
required
Agent UUID.

Response (204)

No content on success.
curl

Get Agent Usage

Get usage statistics for an agent (conversations, messages, token usage, costs).

Path Parameters

string
required
Agent UUID.

Response (200)

Returns usage statistics including conversation counts, message counts, total tokens, and estimated cost.

Version History

Get version history for an agent. Every update creates a new version snapshot.

Path Parameters

string
required
Agent UUID.

Response (200)

object[]
Array of version snapshots, newest first.
number
Total number of versions.

Revert to Version

Revert an agent’s configuration to a specific version. This creates a new version (does not rewrite history).

Path Parameters

string
required
Agent UUID.
number
required
Version number to revert to.

Response (200)

boolean
Always true.
object
Updated agent object.
string
Confirmation message.

Get Draft Status

Get the current publish/draft status of an agent, including any pending review.

Path Parameters

string
required
Agent UUID.

Publishing Lifecycle

Agents follow a publish lifecycle: draft -> submitted for review -> approved/rejected -> published.

Submit for Review

Submit a draft agent for review.

Approve Agent

Approve a submitted agent (requires appropriate role).

Reject Agent

Reject a submitted agent with feedback.

Publish Agent

Publish an approved agent, making it available to end users.

Errors

error
Returned when the agent has no linked knowledge bases, or none of the linked knowledge bases have indexed documents yet.

Get Agent Indexing Status

Returns the indexing status of all knowledge bases linked to this agent. Use this to check whether the agent is ready to be published.

Path Parameters

string
required
Agent UUID.

Response (200)

number
Number of knowledge bases linked to the agent.
number
Total documents across all linked knowledge bases.
number
Documents with processing_status = completed.
number
Documents that failed processing.
number
Documents still pending or processing.
boolean
true when at least one knowledge base is linked and at least one document is indexed.
curl

RBAC Permissions

All agent endpoints enforce role-based access control: