Agent trace exports (GraphQL)

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

ArgumentTypeDescription
jobIdUUID!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

AgentSpanExportState

Enum type.

ValueDescription
PENDING
RUNNING
DONE
FAILED
AgentSpanExportStatusOutput

Object type.

FieldTypeDescription
statusAgentSpanExportState!Current export status. DONE means a presigned download URL is available.
urlStringShort-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.
errorStringSanitized 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.
createdTimeDateTime!When the export job was created.
expiresAtDateTimeWhen the presigned URL expires. Populated when status=DONE; regenerated alongside the URL on each poll.

Related types

DateTime, UUID

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

ArgumentTypeDescription
jobIdUUID!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

AgentTraceExportStatus

Enum type.

ValueDescription
PENDING
RUNNING
DONE
DONE_PARTIAL
FAILED
AgentTraceExportStatusOutput

Object type.

FieldTypeDescription
statusAgentTraceExportStatus!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).
urlStringShort-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.
errorStringSanitized 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.
createdTimeDateTime!When the export job was created.
expiresAtDateTimeWhen the presigned URL expires. Populated when status=DONE or DONE_PARTIAL; regenerated alongside the URL on each poll.

Related types

DateTime, UUID

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

ArgumentTypeDescription
agentNameString!Agent name the spans belong to; applied as a scope filter.
mconString!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

ExportAgentSpans

Object type. Kick off an async export of a selected set of agent spans to S3.

FieldTypeDescription
jobIdUUID!Opaque job id. Poll getAgentSpansExport with this id for status and (when complete) the presigned download URL.

Related types

UUID

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

ArgumentTypeDescription
agentNameStringAgent 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.
mconString!MCON of the agent trace table. Find this in the trace page URL in the Monte Carlo UI, or in the response of getAgentSpanGroups.
traceIdString!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

ExportAgentTrace

Object type. Kick off an async export of a full agent trace to S3.

FieldTypeDescription
jobIdUUID!Opaque job id. Poll getAgentTraceExport with this id for status and (when complete) the presigned download URL.

Related types

UUID

Source: The GraphQL API reference

This page is generated from the GraphQL schema on each release. Changes made in ReadMe are overwritten.