SDK reference · Node SDK

prov.mandate.agents.stats

prov.mandate.agents.stats in Node SDK. Per-agent decision analytics from the ledger (windowed by createdGte/createdLte).

Signature

prov.mandate.agents.stats(id: string, range?: { createdGte?: string; createdLte?: string }): Promise<AgentStats>

Parameters

idstringRequired
range{ createdGte?: string; createdLte?: string }

Request fields

idstringpathRequired
The object's ID.
created_gtestringquery
The start of the time window, as an ISO 8601 time.
created_ltestringquery
The end of the time window, as an ISO 8601 time.

Returns

Promise<AgentStats> The agent's decisions in the window, by result, with the deny rate.

HTTP operation

GET /v1/mandate/agents/{id}/stats: Get an agent's stats

Errors

Example

const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agents`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "invoice-bot" }),
})).json();
const agentId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agents/${agentId}/stats`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.