Agent

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
GET
GET

List all agent fleet approvals

Approval-gated tool requests across every agent in this team. Team-admin only.

Required API key scopes

agents:read

Query parameters

  • agent_id
    string
  • limit
    integer
  • offset
    integer
  • state
    string

Example request

GET /api/projects/:project_id/agent_fleet/approvals
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/agent_fleet/approvals/

Example response

Status 200 No response body

Retrieve agent fleet live

Live (non-terminal) sessions across every agent owned by this team, newest activity first.

Required API key scopes

agents:read

Query parameters

  • limit
    integer

Response


Example request

GET /api/projects/:project_id/agent_fleet/live_sessions
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/agent_fleet/live_sessions/

Example response

Status 200
RESPONSE
{
"results": [
{
"usage_total": {
"tokens_in": 0,
"tokens_out": 0,
"cache_read": 0,
"cache_write": 0,
"cost_input": 0.1,
"cost_output": 0.1,
"cost_cache_read": 0.1,
"cost_cache_write": 0.1,
"cost_total": 0.1
},
"principal": {
"kind": "anonymous",
"id": "string",
"team_id": 0
},
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"application_id": "48ac72d0-a829-4896-a067-dcb1c2b0f30c",
"revision_id": "f8f7f022-982b-4bef-ba7d-4bb808fdbe2a",
"team_id": 0,
"state": "queued",
"external_key": "string",
"trigger_metadata": {},
"turns": 0,
"preview": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]
}

Retrieve agent fleet

Roll-up stats across every agent owned by this team.

Required API key scopes

agents:read

Query parameters

  • since
    string

Response


Example request

GET /api/projects/:project_id/agent_fleet/stats
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/agent_fleet/stats/

Example response

Status 200
RESPONSE
{
"liveCount": 0,
"sessionsInWindowCount": 0,
"spendInWindowUsd": 0.1,
"lastActivityAt": "2019-08-24T14:15:22Z",
"failedInWindowCount": 0,
"pendingApprovalsCount": 0
}

Community questions