List agent spans
const url = 'https://app.prefactorai.com/api/v1/agent_spans?agent_instance_id=013xrzp12g3nqk8ns6jadrqmpgrjkeny&agent_id=013xrzp12g3nqk8ns6jadrqmpgrjkeny&include_summaries=false&include_risk_level=false&redacted=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_spans?agent_instance_id=013xrzp12g3nqk8ns6jadrqmpgrjkeny&agent_id=013xrzp12g3nqk8ns6jadrqmpgrjkeny&include_summaries=false&include_risk_level=false&redacted=false' \ --header 'Authorization: Bearer <token>'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”A valid agent instance ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyA valid agent ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyA valid environment ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyNull
Sort order; a field name, optionally prefixed with - for descending (e.g. -id). Supported fields: id, started_at, finished_at, status.
Sort order; a field name, optionally prefixed with - for descending (e.g. -id). Supported fields: id, started_at, finished_at, status.
Zero-based offset of the first item to return.
Number of items to return per page (1-100).
Include human-readable summaries from schema templates (default: false for performance)
When true, score each activity-purpose span against the agent’s risk profile and populate risk_level and risk_score on the summary.
When true, strip sensitive values from payload and result_payload, and render the summary with redaction labels. Defaults to false.
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 instance ID
object
object
Creates data
Destroys data
Sends external communications
Performs financial transactions
Reads data
Updates data
object
Authentication and secrets present
Behavioural and inferred data present
Classification level
Contact information present
Criminal justice data present
Financial information present
GDPR: biometric data for identification
GDPR: genetic data
GDPR: political opinions
GDPR: racial or ethnic origin
GDPR: religious or philosophical beliefs
GDPR: sex life or sexual orientation
GDPR: trade union membership
Health and medical data present
Location and tracking data present
Minors data present
Organisational confidential data present
Personal identifiers present
object
Authentication and secrets present
Behavioural and inferred data present
Classification level
Contact information present
Criminal justice data present
Financial information present
GDPR: biometric data for identification
GDPR: genetic data
GDPR: political opinions
GDPR: racial or ethnic origin
GDPR: religious or philosophical beliefs
GDPR: sex life or sexual orientation
GDPR: trade union membership
Health and medical data present
Location and tracking data present
Minors data present
Organisational confidential data present
Personal identifiers present
Null
A valid agent span ID
A valid agent span ID
Null
Span payload data (arbitrary JSON object)
object
Approximate JSON-encoded byte size of the span’s stored payload columns. This is an estimate, not an exact on-disk size.
Purpose of the span: ‘activity’ (normal agent activity), ‘quality’ (system-written span recording an agent instance quality payload update), or ‘alert’ (system-written span recording an alert lifecycle event). Quality-purpose and alert-purpose spans are excluded from standard span metrics.
Name of the schema for this span
Human-readable title for the schema (from JSON schema, defaults to schema_name)
When true, both payload and result_payload should be interpreted as containing sensitive markers as per the specification
Status of the span: ‘pending’ (not started), ‘active’ (started but not finished), ‘complete’ (finished successfully), ‘failed’ (ended with failure), or ‘cancelled’ (never started, cancelled)
Type of resource (always ‘agent_span’)
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_instance_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "data_risk": null, "finished_at": "2024-01-01T00:00:00Z", "id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "parent_span_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "purpose": "activity", "result_payload": null, "risk_level": "low", "risk_score": 40, "schema_name": "llm", "schema_title": "LLM", "started_at": "2024-01-01T00:00:00Z", "status": "pending", "summary": null, "type": "agent_span" } ]}default
Section titled “default”Error