Related queries and mutations in Agent traces and evaluations. Each has its own section.
Queries
getAgentSpansExport (query)
getAgentSpansExport is a query in the Monte Carlo GraphQL API, in Agent traces and evaluations. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Status and short-lived (10 min) download URL for a span export job. URL is a bearer credential — do not log or share. Regenerated fresh per call.
Arguments
| Argument | Type | Description |
|---|---|---|
jobId | UUID! | Job id returned by exportAgentSpans. |
Returns
AgentSpanExportStatusOutput
Example
query GetAgentSpansExport($jobId: UUID!) {
getAgentSpansExport(jobId: $jobId) {
status
url
error
createdTime
expiresAt
}
}Types used only by getAgentSpansExport
getAgentSpansExportAgentSpanExportState
AgentSpanExportStateEnum type.
| Value | Description |
|---|---|
PENDING | |
RUNNING | |
DONE | |
FAILED |
AgentSpanExportStatusOutput
AgentSpanExportStatusOutputObject type.
| Field | Type | Description |
|---|---|---|
status | AgentSpanExportState! | Current export status. DONE means a presigned download URL is available. |
url | String | Short-lived (10 min) presigned URL to the JSONL export (one span per line). Populated when status=DONE. Regenerated fresh on each poll — treat as a bearer credential and do not log or share. |
error | String | Sanitized message when status=FAILED — a user-facing validation message (e.g. 'Failed to fetch spans for export') or a generic exception class name. Never echoes span content. |
createdTime | DateTime! | When the export job was created. |
expiresAt | DateTime | When the presigned URL expires. Populated when status=DONE; regenerated alongside the URL on each poll. |
Related types
getAgentTraceExport (query)
getAgentTraceExport is a query in the Monte Carlo GraphQL API, in Agent traces and evaluations. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Status and short-lived (10 min) download URL for an export job. URL is a bearer credential — do not log or share. Regenerated fresh per call.
Arguments
| Argument | Type | Description |
|---|---|---|
jobId | UUID! | Job id returned by exportAgentTrace. |
Returns
AgentTraceExportStatusOutput
Example
query GetAgentTraceExport($jobId: UUID!) {
getAgentTraceExport(jobId: $jobId) {
status
url
error
createdTime
expiresAt
}
}Types used only by getAgentTraceExport
getAgentTraceExportAgentTraceExportStatus
AgentTraceExportStatusEnum type.
| Value | Description |
|---|---|
PENDING | |
RUNNING | |
DONE | |
DONE_PARTIAL | |
FAILED |
AgentTraceExportStatusOutput
AgentTraceExportStatusOutputObject type.
| Field | Type | Description |
|---|---|---|
status | AgentTraceExportStatus! | Current export status. DONE means a complete presigned URL is available; DONE_PARTIAL means the artifact is available but at least one span couldn't be fetched (see error for details). |
url | String | Short-lived (10 min) presigned URL to the gzipped JSON export. Populated when status=DONE or DONE_PARTIAL. Regenerated fresh on each poll — treat as a bearer credential and do not log or share. |
error | String | Sanitized message when status=FAILED or status=DONE_PARTIAL. For FAILED, this is a user-facing validation message (e.g. 'Trace not found') or a generic exception class name. For DONE_PARTIAL, this summarizes what was dropped (e.g. 'N spans dropped due to warehouse payload size cap'). Never echoes trace content. |
createdTime | DateTime! | When the export job was created. |
expiresAt | DateTime | When the presigned URL expires. Populated when status=DONE or DONE_PARTIAL; regenerated alongside the URL on each poll. |
Related types
Mutations
exportAgentSpans (mutation)
exportAgentSpans is a mutation in the Monte Carlo GraphQL API, in Agent traces and evaluations. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Export a selected set of agent spans (trace_id, span_id, conversation_id, model_name, prompts, completions, tool_call_input, tool_call_output) to S3 as JSONL, one span per line. model_name is null for non-LLM spans; tool_call_input and tool_call_output are null for spans carrying no tool-call payload. Returns a job id; poll getAgentSpansExport for the download URL when complete. Async because the warehouse fetch can take longer than Django/ALB HTTP timeouts.
Arguments
| Argument | Type | Description |
|---|---|---|
agentName | String! | Agent name the spans belong to; applied as a scope filter. |
mcon | String! | MCON of the agent trace table. Find this in the trace page URL in the Monte Carlo UI, or in the response of getAgentSpanGroups. |
spanIds | [String!]! | Hex-encoded span ids to export. At least one is required. |
Returns
ExportAgentSpans
Example
mutation ExportAgentSpans($agentName: String!, $mcon: String!, $spanIds: [String!]!) {
exportAgentSpans(agentName: $agentName, mcon: $mcon, spanIds: $spanIds) {
jobId
}
}Types used only by exportAgentSpans
exportAgentSpansExportAgentSpans
ExportAgentSpansObject type. Kick off an async export of a selected set of agent spans to S3.
| Field | Type | Description |
|---|---|---|
jobId | UUID! | Opaque job id. Poll getAgentSpansExport with this id for status and (when complete) the presigned download URL. |
Related types
exportAgentTrace (mutation)
exportAgentTrace is a mutation in the Monte Carlo GraphQL API, in Agent traces and evaluations. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Export a full agent trace (tree + per-span content) to S3 as gzipped JSON. Returns a job id; poll getAgentTraceExport for the download URL when complete. Async because exporting a full trace can take longer than Django/ALB HTTP timeouts.
Arguments
| Argument | Type | Description |
|---|---|---|
agentName | String | Agent the trace belongs to. Disambiguates which agent's content permissions apply when the trace table hosts more than one agent; it does not filter what the export contains. |
mcon | String! | MCON of the agent trace table. Find this in the trace page URL in the Monte Carlo UI, or in the response of getAgentSpanGroups. |
traceId | String! | The trace_id to export. |
Returns
ExportAgentTrace
Example
mutation ExportAgentTrace($mcon: String!, $traceId: String!) {
exportAgentTrace(mcon: $mcon, traceId: $traceId) {
jobId
}
}Types used only by exportAgentTrace
exportAgentTraceExportAgentTrace
ExportAgentTraceObject type. Kick off an async export of a full agent trace to S3.
| Field | Type | Description |
|---|---|---|
jobId | UUID! | Opaque job id. Poll getAgentTraceExport with this id for status and (when complete) the presigned download URL. |
Related types
Source: The GraphQL API reference
This page is generated from the GraphQL schema on each release. Changes made in ReadMe are overwritten.
