Count Executions
Execution
Count Executions
POST
Count Executions
Use this API to get a workspace-wide aggregate count of executions, optionally filtered by
The schema uses
Success Response (
Success Response (
Errors:
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
Your API key.
Your Auth Token.
Body
Params
.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 whetheragentIds 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)
| Field | Type | Description |
|---|---|---|
data.counts | object | Present when agentIds was provided. One key per unique agent ID (deduped). Failed counts → -1. |
data.total | number | Present when agentIds was omitted. Single workspace-wide count, optionally narrowed by status. |
Failure Response
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).

