Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Agents API

Manage agent configurations and chat sessions.


Agent Configuration

List Agent Configurations

Returns all configured agents.

GET /v1/agent/config

Response:

{
  "configs": [
    {
      "name": "assistant",
      "description": "A helpful AI assistant",
      "model_name": "claude-haiku-4-5-20251001",
      "enabled": true,
      "mcp_names": [],
      "mcp_tools": {
        "filesystem": [
          "read_file"
        ]
      },
      "system_prompt": "You are a helpful assistant.",
      "system_prompt_file": null,
      "can_manage_agents": false,
      "enable_extended_thinking": false,
      "reasoning_effort": null
    }
  ]
}

Get Agent Configuration

Returns configuration for a specific agent.

GET /v1/agent/config/{name}

Path Parameters:

ParameterTypeDescription
namestringThe agent name

Response: Single agent configuration object.


Create Agent Configuration

Creates a new agent configuration.

POST /v1/agent/config

Request Body:

{
  "name": "new-agent",
  "model_name": "claude-sonnet-4-5-20250929",
  "enabled": true,
  "description": "A new agent",
  "mcp_names": [],
  "mcp_tools": {
    "database": null
  },
  "system_prompt": "You are an expert assistant.",
  "system_prompt_file": null,
  "can_manage_agents": false,
  "reasoning_effort": "medium"
}

Parameters:

FieldTypeRequiredDescription
namestringYesUnique agent identifier
model_namestringYesLLM model to use
enabledbooleanYesWhether agent is active
descriptionstringNoHuman-readable description
mcp_namesarrayNoLegacy MCP access list (deprecated)
mcp_toolsobjectNoMCP name → tool list mapping
system_promptstringNoInline system prompt
system_prompt_filestringNoReference to prompt file in ~/.archia/prompts/
can_manage_agentsbooleanNoAllow agent to spawn/manage other agents
enable_extended_thinkingbooleanNoDeprecated: Use reasoning_effort instead. If true, sets reasoning to "medium"
reasoning_effortstringNoReasoning intensity: "none", "low", "medium", or "high". Takes precedence over enable_extended_thinking

Reasoning Effort

The reasoning_effort field controls the model’s reasoning behavior. See the Responses API documentation for details on how different providers handle each level.

LevelDescription
noneDisable reasoning (supported by OpenAI gpt-5.0+; maps to low for gpt-oss)
lowLight reasoning, suitable for simpler problems
mediumBalanced reasoning for most tasks
highMaximum reasoning depth for complex problems

Note: If neither reasoning_effort nor enable_extended_thinking is set, the provider’s default behavior is used.

Response: 201 Created with the created agent configuration.


Update Agent Configuration

Updates an existing agent configuration.

PUT /v1/agent/config/{name}

Path Parameters:

ParameterTypeDescription
namestringThe agent name to update

Request Body: Same fields as create, all optional.

Response: 200 OK with the updated agent configuration.


Delete Agent Configuration

Deletes an agent configuration.

DELETE /v1/agent/config/{name}

Path Parameters:

ParameterTypeDescription
namestringThe agent name to delete

Response: 204 No Content


List Available Agents

Returns a list of enabled agents that can be used for chat.

GET /v1/agent

Query Parameters:

ParameterTypeDescription
namestringFilter by agent name
mcpstringFilter by MCP access

Response:

{
  "agents": [
    {
      "name": "assistant",
      "mcps": [
        "filesystem",
        "database"
      ]
    }
  ]
}

Agent Chat

Create Agent Chat

Creates a new chat session with an agent.

POST /v1/agent/chat

Request Body:

{
  "agent_name": "assistant",
  "parent_chat_id": 1,
  "initial_message": "Hello, I need help with..."
}

Parameters:

FieldTypeRequiredDescription
agent_namestringYesAgent to chat with
parent_chat_idintegerYesParent chat context
initial_messagestringNoOptional first message

Response:

{
  "agent_chat_id": 42,
  "agent_name": "assistant",
  "parent_chat_id": 1,
  "model_name": "claude-haiku-4-5-20251001",
  "agent_management_enabled": false
}

Chat Messages

Get Messages

Retrieves messages from a chat.

GET /v1/chat/{chat_id}/message

Path Parameters:

ParameterTypeDescription
chat_idintegerThe chat ID

Response: Array of message objects.


Send Message

Sends a message to a chat.

POST /v1/chat/{chat_id}/message

Path Parameters:

ParameterTypeDescription
chat_idintegerThe chat ID

Request Body:

{
  "agent": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Hello, how can you help me?"
    }
  ]
}

Response:

{
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "I'm here to help! What would you like to know?"
    }
  ],
  "error": null
}

Delete Chat

Deletes a chat session.

DELETE /v1/chat/{chat_id}

Path Parameters:

ParameterTypeDescription
chat_idintegerThe chat ID to delete

Response: 204 No Content


Agent Management

Control agent management capabilities for chat sessions.

Enable Agent Management

Enables agent management capabilities for a chat, allowing the agent to spawn and manage other agents.

POST /v1/agent/management/{chat_id}/enable

Path Parameters:

ParameterTypeDescription
chat_idintegerThe chat ID

Response: 200 OK


Disable Agent Management

Disables agent management capabilities for a chat.

POST /v1/agent/management/{chat_id}/disable

Path Parameters:

ParameterTypeDescription
chat_idintegerThe chat ID

Response: 200 OK


Agent Monitoring

List Active Agents

Returns currently active agent sessions.

GET /v1/agent/monitoring/active

Response:

{
  "active_agents": [
    {
      "chat_id": 1,
      "user_data": {},
      "pending": false,
      "has_messages": true,
      "last_model": "claude-haiku-4-5-20251001",
      "agent_management_enabled": false,
      "message_count": 5
    }
  ],
  "total": 1
}

List Waiting Agents

Returns agent sessions waiting for input (e.g., waiting for tool results).

GET /v1/agent/monitoring/waiting

Response:

{
  "waiting_agents": [
    {
      "agent_chat_id": 42,
      "parent_chat_id": 1,
      "inflight_id": "abc123"
    }
  ],
  "total": 1
}

Examples

Create and Use an Agent

# Create agent
curl -X POST http://localhost:8080/v1/agent/config \
  -H "Content-Type: application/json" \
  -d '{
    "name": "helper",
    "model_name": "claude-haiku-4-5-20251001",
    "enabled": true,
    "system_prompt": "You are a helpful assistant."
  }'

# Use via Responses API (recommended)
curl -X POST http://localhost:8080/v1/responses \
  -H "Content-Type: application/json" \
  -d '{
    "model": "agent:helper",
    "input": "What can you help me with?"
  }'

Create Agent with Reasoning

# Create agent with high reasoning for complex tasks
curl -X POST http://localhost:8080/v1/agent/config \
  -H "Content-Type: application/json" \
  -d '{
    "name": "reasoning-agent",
    "model_name": "gpt-5.1",
    "enabled": true,
    "system_prompt": "You are a problem-solving assistant.",
    "reasoning_effort": "high"
  }'

# Create agent with no reasoning for fast responses
curl -X POST http://localhost:8080/v1/agent/config \
  -H "Content-Type: application/json" \
  -d '{
    "name": "fast-agent",
    "model_name": "gpt-5.1",
    "enabled": true,
    "system_prompt": "You are a quick assistant.",
    "reasoning_effort": "none"
  }'

List and Filter Agents

# List all agent configs
curl http://localhost:8080/v1/agent/config

# List enabled agents
curl http://localhost:8080/v1/agent

# Filter by MCP access
curl "http://localhost:8080/v1/agent?mcp=database"

Next Steps