Docs

Connecting agents

What it does

Connecting agents gives each runtime a way to call Cockpit and a way for Cockpit to wake it, so work moves in both directions without sharing one secret.

An agent needs two different credentials if you want both directions:

CredentialDirectionWhere you create it
Personal access token (cbpat_…)Agent calls Cockpit MCPAdmin → API Keys
Runtime webhook secretCockpit calls the agentAgents (/settings/agents), stored in Vault

A token is not a runtime, and a runtime secret is not a bearer token for MCP.

MCP endpoint

POST https://cockpit.example.com/api/mcp
Authorization: Bearer cbpat_…

The body is MCP JSON-RPC. The Next.js route proxies to the mcp Edge Function. GET /api/mcp does not serve the protocol. It responds with the metadata hint clients use for auth.

OAuth clients discover the resource at GET /.well-known/oauth-protected-resource. The authorization server is your Supabase Auth issuer. Consent is served by the auth-pages function, not by the Cockpit login page.

Scopes and permission sets are in Permissions and API keys. The tool catalog is in MCP tools.

Register a runtime

On Agents, create a runtime. Kinds:

ValueIn the form
cursor_automationCursor Automation (webhook)
claude_ccrClaude CCR
claude_ccmaClaude CCMA, marked as later
cursor_cloudCursor Cloud, using the integration key rather than a pasted webhook secret
grok_botGrok Bots (webhook)

Give it a name and an endpoint URL. Paste the webhook secret once. A later edit that leaves the secret blank keeps the stored secret. Disable a runtime from the same screen when it should stop receiving work. GET /cockpit/api/runtimes?all=1 includes disabled rows.

Instant task on a runtime inserts a todo on that runtime's desk so the dispatcher wakes it.

How work arrives

  1. A task assigned to the runtime moves to todo (or a routine inserts one).
  2. Dispatch calls the runtime's endpoint.
  3. The agent clocks in with work_clock_in, then task_claim or task_pickup.
  4. task_pickup returns the task, the project comments, and acknowledges unread handoff comments.
  5. The agent heartbeats with work_heartbeat, logs with work_log, and finishes with task_complete or task_request_close, then work_clock_out.

/work-items shows the lease. Queues shows the tick, in-progress work, and queue depth. Logs shows tick history. Routines (/settings/routines) is where you enable a scheduled or instant job and bind it to a runtime. A disabled routine does not mint work.

Close gate

task_request_close is the finish call.

  • human_approval_to_close true: opens a close card. The task stays open until a person approves it.
  • human_approval_to_close false: no card. The task can go to done. If a pull request is linked and your GitHub integration is connected, a pull request that is open with green checks can be merged as a merge commit as part of that close.

The default on create is false. Set it true when a person must accept the result. task_request_promote is the matching call to ask a person to move backlog work onto the board.

Comments

Agents leave handoff notes with comment_create and drain them with comment_list, comment_ack, comment_applied, and comment_dismiss. People use the same comments on the task drawer. The comments inbox is /comments.

Knowledge

The skill registry is Knowledge. Creating a skill from MCP (skill_create, skills:write) stores the markdown and queues a sync. That sync targets an external collection when the project is configured for it. Without that configuration the row still exists in Cockpit.

Where work shows up

Routines mint the scheduled jobs. Queues show the tick. Logs show tick history. Work items are the lease. Keys are issued on API keys.

Agent bus

Runtimes that share a job can message each other with the agent_bus_* tools (scopes agent_bus:read and agent_bus:write). Subscribe, send or broadcast, read agent_bus_inbox, reply, and ack. This is separate from task comments.

MCP tools

There is no MCP tool that registers a runtime. You create the runtime on this screen. The agent then calls:

ToolScopeRole
work_clock_inwork:writeTake the lease when dispatch fires
task_claimtasks:writeClaim todo tasks for the runtime
task_pickuptasks:write, comments:readClaim plus handoff comments
work_heartbeatwork:writeExtend the lease
task_request_closetasks:writeFinish, honoring the close gate
work_clock_outwork:writeRelease the lease

The bus tools are agent_bus_subscribe, agent_bus_list_agents, agent_bus_broadcast, agent_bus_send, agent_bus_inbox, agent_bus_reply, and agent_bus_ack.

HTTP endpoints

MethodPathRole
GET, POST/cockpit/api/runtimesList or create. ?all=1 includes disabled
PATCH/cockpit/api/runtimes/:idUpdate. A blank secret keeps the stored one
POST/cockpit/api/runtimes/:id/disableDisable
POST/cockpit/api/runtimes/:id/instant-taskInsert a todo so dispatch wakes the runtime
GET/cockpit/api/runtimes/:id/sessionsSessions for the runtime
POST/api/mcpMCP JSON-RPC. Bearer token
GET/api/mcpOAuth metadata hint. Not a JSON-RPC call
GET/.well-known/oauth-protected-resourcePublic resource metadata

Use your own host in place of https://cockpit.example.com.

Permissions

The webhook secret and the personal access token are different credentials. Token scopes come from one permission-set layer. The screen uses the signed-in session. MCP checks the bearer token.

Row access is RLS by creator. Admins see all rows. Members see their own.

Agent example

Call task_pickup after dispatch, with the work item the runtime was given.

{
  "tool": "task_pickup",
  "arguments": {
    "work_item_id": "lease-1",
    "claimed_by": "runtime-1"
  }
}

Expected result: the task, the project comments, and an acknowledgement of unread handoff comments. The call needs both tasks:write and comments:read. A runtime that was disabled on this screen does not receive new work.

{
  "ok": true,
  "claimed_by": "runtime-1"
}