List agent instances
const url = 'https://app.prefactorai.com/api/v1/agent_instance?agent_id=013xrzp12g3nqk8ns6jadrqmpgrjkeny&agent_version_id=013xrzp12g3nqk8ns6jadrqmpgrjkeny&pagination%5Bpage_with_id%5D=013xrzp12g3nqk8ns6jadrqmpgrjkeny&include_risk_score=false&include_alert_count=false';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://app.prefactorai.com/api/v1/agent_instance?agent_id=013xrzp12g3nqk8ns6jadrqmpgrjkeny&agent_version_id=013xrzp12g3nqk8ns6jadrqmpgrjkeny&pagination%5Bpage_with_id%5D=013xrzp12g3nqk8ns6jadrqmpgrjkeny&include_risk_score=false&include_alert_count=false' \ --header 'Authorization: Bearer <token>'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”A valid agent ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyA valid agent version ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenySort order; a field name, optionally prefixed with - for descending (e.g. -id). Supported fields: id, status, last_activity_span_at.
Sort order; a field name, optionally prefixed with - for descending (e.g. -id). Supported fields: id, status, last_activity_span_at.
Zero-based offset of the first item to return.
Number of items to return per page (1-100).
A valid agent instance ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyReturn the page that contains this id (page-aligned from offset 0). Do not combine with pagination[offset].
Include risk_score in each summary (null when the agent has no risk profile or scoring inputs are unavailable)
Include raised_alert_count in the response (counts only alerts the caller may show)
Responses
Section titled “Responses”Success
object
Pagination information
object
The total number of items
The index of the last item in the page (one-based)
The index of the first item in the page (one-based)
The total number of pages
The index of the current page (one-based)
The offset of the first item in the page (zero-based)
The number of items per page
Null
object
A valid account ID
A valid agent ID
A valid agent version ID
A valid environment ID
A valid agent instance ID
When the agent instance was created
Why this instance ran: ‘live’ for an actual agent run, ‘smoke_test’ for a pipeline check, or ‘eval’ for an evaluation run
object
Unique included data categories across params and results of span types that ran, in canonical order
Actions allowed by at least one span type that ran in this instance, in canonical order
Whether the instance has at least one span type with scoreable data_risk
Critical threshold from the agent’s risk profile ruleset
Per-schema-type score breakdown
object
Number of span invocations for this schema type
Risk level bucket for this schema type’s per-invocation score
Span type schema name
Type_score multiplied by count
Risk score for a single invocation of this schema type
Total risk score across all span types for this instance
Null
Status of the agent instance: ‘pending’ (not started yet), ‘active’ (started but not finished), ‘complete’ (finished successfully), ‘failed’ (ended with failure), ‘cancelled’ (never started, cancelled), or ‘terminated’ (externally terminated)
Type of resource (always ‘agent_instance’)
When the agent instance was last updated
Example
{ "pagination": { "item_count": 200, "item_end": 100, "item_start": 91, "next_page_offset": 110, "page_count": 20, "page_index": 10, "page_offset": 90, "page_size": 10, "previous_page_offset": 80 }, "sorting": null, "status": "success", "summaries": [ { "account_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "agent_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "agent_version_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "environment_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "finished_at": "2024-01-01T00:00:00Z", "id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "inserted_at": "2024-01-01T00:00:00Z", "last_activity_span_at": "2024-01-01T00:00:00Z", "purpose": "live", "raised_alert_count": null, "risk_score": null, "started_at": "2024-01-01T00:00:00Z", "status": "pending", "termination_reason": "User requested termination", "type": "agent_instance", "updated_at": "2024-01-01T00:00:00Z" } ]}default
Section titled “default”Error