Skip to main content
POST
Count Executions
Use this API to get a workspace-wide aggregate count of executions, optionally filtered by agentIds and/or status. Designed for poll-based “N running” counters: poll periodically with an array of agent IDs and get back a { counts: { [agentId]: number } } map. Read-only. Never enqueues a Cloud Task.

Endpoint

POST https://api.velt.dev/v2/agents/execution/count

Headers

x-velt-api-key
string
required
Your API key.
x-velt-auth-token
string
required

Body

Params

data
object
required
The schema uses .strict(): unknown top-level fields are rejected.

Example Requests

1. Count running executions for a set of agents

2. Count all executions of a single agent

3. Workspace-wide total (no filter)

4. Workspace-wide total, filtered by status

Response

The response shape depends on whether agentIds was provided. counts and total are mutually exclusive: exactly one is present.

Success Response (agentIds provided → counts map)

Partial-failure contract: if a per-agent count fails, the response is still 200 success and that agent’s value is the integer sentinel -1 (not null, not omitted). The map stays a uniform Record<string, number>, so clients never need to parse JSON null. Unknown agent IDs simply return 0.

Success Response (agentIds omitted → total)

Failure Response

Errors: INVALID_ARGUMENT (empty agentIds array, agentIds exceeding 200 elements, invalid status, or an unknown top-level field) / NOT_FOUND (workspace store database could not be resolved).