Skip to main content

Overview

The Agents API provides direct access to individual AI agents in your organization. Unlike the Chat Completions API which routes requests through an orchestrator, this API allows you to invoke specific agents directly for targeted tasks.
Direct Agent Invocation: Use this API when you know exactly which agent should handle your request. For intelligent routing across multiple agents, use the Chat Completions API instead.

Authentication

All endpoints require API key authentication with specific scopes:
Default Scopes: The agents:list and agents:invoke scopes are enabled by default when creating API keys. No additional configuration is needed.
Include your API key in the X-API-Key header:
See Authentication for details.

Agent Types

Agents in the system are categorized by their execution pattern:
LLM Agents Only: Only LLM_AGENT type agents can be invoked directly via this API. Sequential, Parallel, and Loop agents are container agents that orchestrate other agents.

List Agents

Retrieve a list of available agents in your organization.

Endpoint

Query Parameters

Request Example

cURL
Python

Response

Status Code: 200 OK

Response Fields

Agent Object Fields


Invoke Agent (Non-Streaming)

Send a message to a specific agent and receive the complete response.

Endpoint

Path Parameters

Request Body

Request Example

cURL
Python

Response

Status Code: 200 OK

Response Fields


Invoke Agent (Streaming)

Send a message and receive the response as a real-time stream using Server-Sent Events (SSE).

Endpoint

Request Body

Request Example

cURL
Python
JavaScript

SSE Response Format

The streaming response uses OpenAI-compatible format with choices array:

Streaming Response Example

Chunk Object Fields


Session Continuity

You can maintain conversation context by reusing the session_id from previous responses:
Python

Error Responses

Common Errors

400 Bad Request - Invalid Agent Type Filter
400 Bad Request - Inactive Agent
402 Payment Required - Insufficient Credits
403 Forbidden - No Subscription
403 Forbidden - Insufficient Scopes
404 Not Found

Best Practices

Use the List Agents endpoint to discover available agents and their capabilities:
For streaming responses, implement proper SSE parsing:
Implement comprehensive error handling for production use:
Efficiently manage sessions for multi-turn conversations:

Authentication

Learn about API key scopes and authentication

Chat Completions

Use orchestrated multi-agent conversations

Sessions API

Manage and retrieve conversation sessions

Error Codes

Full list of error codes and solutions