Agents API

The agents routes manage agent records, deployments, logs, and metrics.

Runtime-facing agent endpoints such as heartbeat, command polling, log submission, and GET /agents/{agent_id}/status use the agent API key as a bearer token. Control-plane users should use the standard GET /agents/{agent_id} route instead.

Current Implementation Notes

  • Routes are mounted at /agents, not /v1/agents.

  • POST /agents derives ownership from the authenticated user instead of accepting user_id in the request body.

  • config is currently modeled as a string field, so JSON config should be sent as a string payload.

  • Auth dependencies are attached to these route handlers, so agent operations require authenticated control-plane access.

Routes

Route
Purpose

POST /agents

Create an agent record

GET /agents

List agents

GET /agents/{agent_id}

Get one agent with deployments

GET /agents/{agent_id}/status

Get runtime status for the authenticated agent

DELETE /agents/{agent_id}

Delete an agent

POST /agents/{agent_id}/deploy

Create a deployment record and mark the agent running

POST /agents/{agent_id}/stop

Stop active deployments for an agent

GET /agents/{agent_id}/logs

List agent logs

GET /agents/{agent_id}/metrics

List agent metrics

Create an Agent

Authenticate first, then create the agent without sending a user_id.

Example response:

List Agents

Optional filters:

  • skip

  • limit

  • user_id

Get an Agent

The detail response includes a deployments array.

Get Runtime Status

This runtime endpoint is only for the authenticated agent itself.

If the bearer token belongs to a different agent, the API returns 403 Agent ID mismatch.

Deploy an Agent

Example response:

Stop an Agent

Agent Logs

Agent Metrics

Delete an Agent

Successful deletion returns 204 No Content.

Status Values

Current agent status enum values from src/api/models/models.py:

  • creating

  • running

  • stopped

  • failed

  • deleting

Last updated