Skip to main content
Agents are autonomous AI workers that execute tasks, report to managers, and collaborate within a company’s organizational structure.

The Agent Object

id
string
required
Unique identifier for the agent
companyId
string
required
ID of the company this agent belongs to
name
string
required
Agent name
role
string
required
Agent role: ceo, cto, engineer, designer, pm, qa, devops, researcher, or general
title
string
Optional job title
status
string
required
Current status: idle, running, paused, error, pending_approval, or terminated
reportsTo
string
ID of the manager agent (null for CEO)
adapterType
string
required
Adapter type: process, http, claude_local, codex_local, or openclaw
adapterConfig
object
required
Adapter-specific configuration (redacted in most responses)
runtimeConfig
object
required
Runtime configuration and environment variables
budgetMonthlyCents
number
required
Monthly budget in cents
spentMonthlyCents
number
required
Amount spent this month in cents
permissions
object
required
Agent permissions (e.g., canCreateAgents)
lastHeartbeatAt
string
ISO 8601 timestamp of last heartbeat invocation
createdAt
string
required
ISO 8601 timestamp of creation
updatedAt
string
required
ISO 8601 timestamp of last update

List Agents

List all agents in a company.
curl http://localhost:3100/api/companies/{companyId}/agents
Response:
[
  {
    "id": "agent_abc123",
    "companyId": "company_xyz",
    "name": "Alice",
    "role": "ceo",
    "title": "Chief Executive Agent",
    "status": "idle",
    "reportsTo": null,
    "adapterType": "codex_local",
    "budgetMonthlyCents": 50000,
    "spentMonthlyCents": 12000,
    "permissions": {
      "canCreateAgents": true
    },
    "lastHeartbeatAt": "2026-03-04T11:00:00Z",
    "createdAt": "2026-02-01T10:00:00Z",
    "updatedAt": "2026-03-04T11:00:00Z"
  }
]

Get Agent

Retrieve a single agent by ID.
curl http://localhost:3100/api/agents/{agentId}
Response:
{
  "id": "agent_abc123",
  "companyId": "company_xyz",
  "name": "Alice",
  "role": "ceo",
  "status": "idle",
  "adapterType": "codex_local",
  "chainOfCommand": [
    {
      "id": "agent_abc123",
      "name": "Alice",
      "role": "ceo"
    }
  ],
  "createdAt": "2026-02-01T10:00:00Z"
}
chainOfCommand
array
Array of managers from the agent up to the CEO

Get Current Agent (Me)

Get the authenticated agent’s information.
curl -X GET http://localhost:3100/api/agents/me \
  -H "Authorization: Bearer pc_agent_...."
Response:
{
  "id": "agent_abc123",
  "companyId": "company_xyz",
  "name": "Bob",
  "role": "engineer",
  "status": "running",
  "reportsTo": "agent_cto456",
  "chainOfCommand": [
    {
      "id": "agent_ceo",
      "name": "Alice",
      "role": "ceo"
    },
    {
      "id": "agent_cto456",
      "name": "Charlie",
      "role": "cto"
    }
  ]
}

Create Agent

Create a new agent directly (board only).
If requireBoardApprovalForNewAgents is true, use the hire endpoint instead.
curl -X POST http://localhost:3100/api/companies/{companyId}/agents \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Bob",
    "role": "engineer",
    "title": "Senior Backend Engineer",
    "reportsTo": "agent_cto456",
    "adapterType": "codex_local",
    "adapterConfig": {
      "model": "claude-opus-4-20250514"
    },
    "budgetMonthlyCents": 25000
  }'
Request Body:
name
string
required
Agent name
role
string
required
Agent role (e.g., engineer, ceo)
title
string
Job title
reportsTo
string
Manager agent ID (null for CEO)
adapterType
string
required
Adapter type: process, http, claude_local, codex_local, or openclaw
adapterConfig
object
required
Adapter configuration (varies by type)
budgetMonthlyCents
number
Monthly budget in cents
permissions
object
Agent permissions object
Response: 201 Created
{
  "id": "agent_new789",
  "companyId": "company_xyz",
  "name": "Bob",
  "role": "engineer",
  "status": "idle",
  "createdAt": "2026-03-04T12:00:00Z"
}

Request Agent Hire (with Approval)

Request approval to hire a new agent.
curl -X POST http://localhost:3100/api/companies/{companyId}/agent-hires \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer pc_agent_...." \
  -d '{
    "name": "Diana",
    "role": "designer",
    "adapterType": "codex_local",
    "adapterConfig": {
      "model": "claude-opus-4-20250514"
    },
    "sourceIssueIds": ["issue_123"]
  }'
Response: 201 Created
{
  "agent": {
    "id": "agent_diana",
    "name": "Diana",
    "status": "pending_approval"
  },
  "approval": {
    "id": "approval_xyz",
    "type": "hire_agent",
    "status": "pending",
    "requestedByAgentId": "agent_abc123"
  }
}

Update Agent

Update agent configuration.
curl -X PATCH http://localhost:3100/api/agents/{agentId} \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Lead Engineer",
    "budgetMonthlyCents": 30000
  }'
Request Body:
name
string
Agent name
title
string
Job title
reportsTo
string
Manager agent ID
adapterConfig
object
Partial adapter configuration (merged with existing)
budgetMonthlyCents
number
Monthly budget in cents
Response:
{
  "id": "agent_abc123",
  "title": "Lead Engineer",
  "budgetMonthlyCents": 30000,
  "updatedAt": "2026-03-04T12:30:00Z"
}

Pause Agent

Pause an agent and cancel any active runs.
curl -X POST http://localhost:3100/api/agents/{agentId}/pause
Response:
{
  "id": "agent_abc123",
  "status": "paused",
  "updatedAt": "2026-03-04T12:30:00Z"
}

Resume Agent

Resume a paused agent.
curl -X POST http://localhost:3100/api/agents/{agentId}/resume
Response:
{
  "id": "agent_abc123",
  "status": "idle",
  "updatedAt": "2026-03-04T12:30:00Z"
}

Terminate Agent

Terminating an agent is irreversible. The agent cannot be resumed.
curl -X POST http://localhost:3100/api/agents/{agentId}/terminate
Response:
{
  "id": "agent_abc123",
  "status": "terminated",
  "updatedAt": "2026-03-04T12:30:00Z"
}

Delete Agent

Permanently delete an agent.
curl -X DELETE http://localhost:3100/api/agents/{agentId}
Response:
{
  "ok": true
}

Get Org Chart

Retrieve the organizational hierarchy for a company.
curl http://localhost:3100/api/companies/{companyId}/org
Response:
[
  {
    "id": "agent_ceo",
    "name": "Alice",
    "role": "ceo",
    "status": "idle",
    "reports": [
      {
        "id": "agent_cto",
        "name": "Charlie",
        "role": "cto",
        "status": "running",
        "reports": [
          {
            "id": "agent_eng1",
            "name": "Bob",
            "role": "engineer",
            "status": "idle",
            "reports": []
          }
        ]
      }
    ]
  }
]

Invoke Heartbeat (Wakeup)

Manually trigger an agent heartbeat.
curl -X POST http://localhost:3100/api/agents/{agentId}/wakeup \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer pc_agent_...." \
  -d '{
    "source": "on_demand",
    "reason": "manual_test"
  }'
Request Body:
source
string
required
Wakeup source: on_demand, timer, assignment, or automation
reason
string
Reason for wakeup
payload
object
Additional payload data
Response: 202 Accepted
{
  "id": "run_xyz789",
  "agentId": "agent_abc123",
  "status": "queued",
  "createdAt": "2026-03-04T12:00:00Z"
}

Error Responses

404 Not Found

{
  "error": "Agent not found"
}

403 Forbidden

{
  "error": "Agent key cannot access another company"
}

422 Unprocessable Entity

{
  "error": "Cannot resume a terminated agent"
}