List runs — GET /v1/agent/{ref}/runs

Returns one agent's execution history, newest first — each run's input, its output or its error, and how long it took.

GET /v1/agent/{ref}/runs

Addresshttps://api.hanzo.ai/v1/agent/{ref}/runs
MethodGET
Operationget_agent_by_ref_runs
AuthAuthorization: Bearer $HANZO_API_KEY

Returns one agent's execution history, newest first — each run's input, its output or its error, and how long it took. Every row is a run that actually happened.

Request

2 fields.

FieldInTypeRequiredDescription
refpathstringyesRef is the agent's public id or its org-unique name, from the path.
limitqueryinteger—Limit caps how many runs come back, newest first.

Response

StatusBodyMeaning
200agent.runListok
defaultproblem-detailsrefused

200 body — 16 fields.

FieldInTypeAlwaysDescription
runsbodyagent.agentRunView[]—Runs is the agent's executions, newest first.
runs[].actorbodystring—Actor is the "org/sub" identity the run was executed and billed AS.
runs[].agentbodystring—What an operator needs to answer "what ran, for whom, and what did it do" — and, through traceId, to leave this record for the waterfall of the very same run rather than a search that hopefully lands near it.
runs[].completionTokensbodyinteger (int64)—CompletionTokens is the same measurement for what the model produced, on the same final completion.
runs[].createdAtbodystring—CreatedAt is when the run finished, RFC 3339 in UTC to the second — the duration above already says how long it had been going.
runs[].durationMsbodyinteger (int64)—DurationMs is wall-clock milliseconds around the completion, including a failover's retries.
runs[].errorbodystring—Error is why an "ok"-less run failed, as the failing call reported it.
runs[].idbodystring—ID is the run's handle, minted as "run_" + 32 hex characters.
runs[].inputbodystring—Input is the text the run was given, verbatim.
runs[].micro_usdbodyinteger (int64)—MicroUSD is what the run spent, integer micro-USD.
runs[].modelbodystring—Model is the model that actually SERVED this run, which is not always the one the agent is defined on — a failover records what answered.
runs[].outputbodystring—Output is what the model produced.
runs[].promptTokensbodyinteger (int64)—PromptTokens is what the gateway reported for the run's FINAL completion, and only that one — a tool loop's earlier rounds are the metering ledger's account, joined by this run's id.
runs[].statusbodystring—Status is the run's outcome, and there are exactly two: "ok" when the model answered, "error" when it did not.
runs[].toolCallsbodyinteger (int64)—ToolCalls is how many tool dispatches the run made — a count of ACTIONS, which is a different measurement from the token counts above and from the turns a build reports.
runs[].traceIdbodystring—TraceID is the trace this run IS, so the record and its spans are one thing to move between: it opens the waterfall for THIS run rather than a search that lands near it.

Failure carries the platform error shape — see Errors.

Examples

hanzo agent runs <ref>
import { Configuration, AgentApi } from 'hanzoai';

const api = new AgentApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAgentByRefRuns({ ref: 'ref' });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AgentApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AgentApi(client).get_agent_by_ref_runs(ref='ref')
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AgentAPI.GetAgentByRefRuns(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, agent_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = agent_api::get_agent_by_ref_runs(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AgentApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AgentApi(client).getAgentByRefRuns();
curl https://api.hanzo.ai/v1/agent/<ref>/runs \
  -H "Authorization: Bearer $HANZO_API_KEY"

Tool agent, op get_agent_by_ref_runs — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "agent",
         "arguments": {
           "op": "get_agent_by_ref_runs",
           "input": {
             "ref": "<ref>"
           }
         }
       }
     }'

Agent API · All Hanzo APIs · Interactive reference

Was this page useful?