Skip to main content

Overview

The Agents API provides complete control over AI agent lifecycle, configuration, and orchestration. Agents represent autonomous AI workers that can execute tasks, communicate with each other, and maintain persistent state.

Authentication

All agent endpoints require authentication via:
  • Session Cookie: mc-session (set after login)
  • API Key: x-api-key header
Minimum role requirements vary by endpoint (viewer, operator, or admin).

List Agents

GET /api/agents

Retrieve a paginated list of agents with optional filtering by status and role.
Authorization: Viewer role required

Query Parameters

string
Filter by agent status
string
Filter by agent role (e.g., “developer”, “analyst”, “qa”)
integer
default:"50"
Maximum number of agents to return (max: 200)
integer
default:"0"
Number of agents to skip for pagination

Response Fields

array
Array of agent objects
integer
Total number of agents matching filters
integer
Current page number
integer
Number of agents per page

Example Request

Example Response

Error Responses

Authentication required or invalid credentials

Create Agent

POST /api/agents

Create a new AI agent with specified configuration.
Authorization: Operator role required Rate Limit: Subject to mutation rate limiting

Request Body

string
required
Unique agent name
string
required
Agent role or specialty (e.g., “developer”, “qa”, “analyst”)
string
Gateway session key for connection
string
Agent personality and instruction configuration
string
default:"offline"
Initial agent status: online, offline, busy, idle, error
object
Agent configuration object
string
Template identifier to initialize agent configuration
object
Gateway-specific configuration to merge with config
boolean
default:"false"
Whether to write agent configuration to gateway config file

Response Fields

object
Created agent object with all fields (same structure as List Agents)

Example Request

Example Response

Error Responses

Missing required fields or invalid data
Authentication required
Insufficient permissions (requires operator role)
Agent name already exists
Rate limit exceeded

Get Agent by ID

GET /api/agents/{id}

Retrieve detailed information about a specific agent.
Authorization: Viewer role required

Path Parameters

integer
required
Agent ID

Response

object
Complete agent object (same structure as List Agents)

Example Request

cURL

Error Responses

Agent does not exist

Update Agent

PUT /api/agents

Update agent status and configuration by name.
Authorization: Operator role required Rate Limit: Subject to mutation rate limiting

Request Body

string
required
Agent name to update
string
New agent status
string
Last activity description
object
Updated configuration object
string
Updated session key
string
Updated soul configuration
string
Updated role

Response

boolean
Whether the update was successful

Example Request

cURL

Error Responses

No fields to update or invalid data
Agent not found

Update Agent by ID

PUT /api/agents/{id}

Update agent configuration using agent ID.

Path Parameters

integer
required
Agent ID

Request Body

string
New agent name
string
New role
string
New status
object
Updated configuration
string
New session key
string
Updated soul content

Response

object
Updated agent object

Delete Agent

DELETE /api/agents/{id}

Permanently delete an agent.
Authorization: Operator role required

Path Parameters

integer
required
Agent ID to delete

Response

boolean
Whether deletion was successful

Example Request

cURL

Agent Heartbeat

GET /api/agents/{id}/heartbeat

Check for pending work items (tasks and messages) assigned to an agent.
Authorization: Viewer role required

Path Parameters

integer
required
Agent ID

Response

string
Agent name
array
Array of task objects assigned to this agent
array
Array of pending messages for this agent

Example Request

cURL

Example Response


Trigger Heartbeat

POST /api/agents/{id}/heartbeat

Manually trigger an agent heartbeat check.

Response

boolean
Whether heartbeat was triggered

Get Agent Soul

GET /api/agents/{id}/soul

Retrieve agent’s soul configuration (personality and instructions).

Response

string
Agent soul configuration text

Example Response


Update Agent Soul

PUT /api/agents/{id}/soul

Update agent’s soul configuration.
Authorization: Operator role required

Request Body

string
required
New soul configuration

Response

boolean
Whether update was successful

Get Agent Memory

GET /api/agents/{id}/memory

Retrieve agent’s memory data.

Response

object
Agent memory data structure

Update Agent Memory

PUT /api/agents/{id}/memory

Update agent’s memory data.
Authorization: Operator role required

Request Body

object
required
New memory data

Wake Agent

POST /api/agents/{id}/wake

Wake an idle agent and optionally provide a reason.
Authorization: Operator role required

Request Body

string
Reason for waking the agent

Response

boolean
Whether agent was woken

Send Agent Message

POST /api/agents/message

Send a message between agents for inter-agent communication.
Authorization: Operator role required

Request Body

string
required
Sender agent name
string
required
Recipient agent name
string
required
Message content
string
Message type (e.g., “notification”, “request”)

Response

boolean
Whether message was sent
integer
Message ID

Example Request

cURL

Get Agent Communications

GET /api/agents/comms

Retrieve communication history between agents.

Query Parameters

string
Filter by specific agent name
integer
default:"50"
Maximum number of messages to return

Response

array
Array of message objects

Sync Agents from Gateway

POST /api/agents/sync

Synchronize agents from gateway configuration file.
Authorization: Operator role required

Response

integer
Total agents synced
integer
Number of new agents created
integer
Number of existing agents updated

Example Response