POST
/
Run Agent
curl --request POST \
  --url https://api.agentbase.sh/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "message": "<string>",
  "mode": "<string>",
  "system": "<string>",
  "mcpServers": [
    {}
  ],
  "rules": [
    "<string>"
  ],
  "streaming": true
}'

Query Parameters

session
string
The session ID to continue the agent session conversation. If not provided, a new agent session will be created.

Request Body

message
string
required
The task or message to run the agent with.
mode
string
default:"fast"
The mode of the agent. Can be flash, fast or max. Flash mode is great for simple, one-off tasks. Fast mode is much faster and cheaper, with comparable performance to max mode. The Agents API defaults to fast.
system
string
A system prompt to provide system information to the agent. The Agents API defaults to the Agentbase default system prompt.
mcpServers
{serverName: string, serverUrl: string}[]
A set of MCP servers to provide to the agent. MCP servers configs are not stored within the agent, so each request must include the MCP servers configs, and you can modify them each time. You need to provide both serverName and serverUrl. We have backward compatibility with the old /sse endpoint.
{
  "mcpServers": [
    { "serverName": "mcp-server-1", "serverUrl": "https://mcp-server-1.com/mcp" },
    { "serverName": "mcp-server-2", "serverUrl": "https://mcp-server-2.com/mcp" }
  ]
}
rules
string[]
A set of rules to provide to the agent. Rules are a set of constraints that the agent must follow. Defaults to no rules.
streaming
boolean
Whether to stream the agent messages token by token. Defaults to false.
See Streaming Message Types for event details.