aip_sdk.traces
Passive agent-trace ingestion and ground truth.
Land passively-collected agent traces into an AIP dataset — either by posting the trace payloads inline, or by triggering a pull from a saved object-store connection. Ingestion runs asynchronously; the returned run object carries the run status and, once complete, the dataset version the traces landed in. Rows that fail to land are recorded as drops you can inspect for diagnostics.
A landed version carries only what your telemetry emitted, so a metric needing a reference
answer reports OP_MISSING_COLUMNS against it. Attach that reference answer with
attach_ground_truth(), read back what a version carries with get_ground_truth(),
and choose which version metrics score with promote_trace_version().
aip_sdk.traces.GROUND_TRUTH_FILE_SUFFIXES
aip_sdk.traces.GROUND_TRUTH_FILE_SUFFIXES = ('.csv', '.json', '.jsonl')
No docstring is defined in the source.
aip_sdk.traces.INGEST_CONVENTIONS
aip_sdk.traces.INGEST_CONVENTIONS = ('openinference', 'genai', 'langsmith')
No docstring is defined in the source.
aip_sdk.traces.MAX_DROPS_PER_PAGE
aip_sdk.traces.MAX_DROPS_PER_PAGE = 2000
No docstring is defined in the source.
aip_sdk.traces.MAX_GROUND_TRUTH_ROWS_PER_PAGE
aip_sdk.traces.MAX_GROUND_TRUTH_ROWS_PER_PAGE = 2000
No docstring is defined in the source.
aip_sdk.traces.RETENTION_DAYS
aip_sdk.traces.RETENTION_DAYS = (7, 30, 90)
No docstring is defined in the source.
aip_sdk.traces.TraceCurrentVersion
aip_sdk.traces.TraceCurrentVersion
The trace dataset version metrics score, after choosing it.
aip_sdk.traces.TraceCurrentVersion.dataset_id
aip_sdk.traces.TraceCurrentVersion.dataset_id: str
No docstring is defined in the source.
aip_sdk.traces.TraceCurrentVersion.dataset_version_id
aip_sdk.traces.TraceCurrentVersion.dataset_version_id: str
No docstring is defined in the source.
aip_sdk.traces.TraceCurrentVersion.is_golden
aip_sdk.traces.TraceCurrentVersion.is_golden: bool
No docstring is defined in the source.
aip_sdk.traces.TraceCurrentVersion.model_config
aip_sdk.traces.TraceCurrentVersion.model_config = ConfigDict(extra='allow')
No docstring is defined in the source.
aip_sdk.traces.TraceCurrentVersion.stage
aip_sdk.traces.TraceCurrentVersion.stage: str
No docstring is defined in the source.
aip_sdk.traces.TraceCurrentVersion.version
aip_sdk.traces.TraceCurrentVersion.version: int
No docstring is defined in the source.
aip_sdk.traces.TraceDropReason
aip_sdk.traces.TraceDropReason
Why a record failed to land — a closed set, so every case can be handled.
At TraceDropStage.PULL: DECODE_ERROR (the source bytes were not readable as
trace data) and FRAME_UNSUPPORTED (readable, but not a shape spans can be read out of).
At TraceDropStage.CONVERT: NO_CONVENTION (the record matched none of the source
conventions — the export is what has to change), NO_HANDLER (the named
ingest_convention is one this platform release cannot convert, which drops every record
in the batch — land without naming one to auto-detect instead), CONVENTION_MISMATCH (the
named ingest_convention doesn't match this record's shape — the forced convention is
wrong for the payload), and HANDLER_ERROR (the record matched a convention but could not
be converted; TraceDropRecord.detail says what failed).
aip_sdk.traces.TraceDropReason.CONVENTION_MISMATCH
aip_sdk.traces.TraceDropReason.CONVENTION_MISMATCH = 'convention_mismatch'
No docstring is defined in the source.
aip_sdk.traces.TraceDropReason.DECODE_ERROR
aip_sdk.traces.TraceDropReason.DECODE_ERROR = 'decode_error'
No docstring is defined in the source.
aip_sdk.traces.TraceDropReason.FRAME_UNSUPPORTED
aip_sdk.traces.TraceDropReason.FRAME_UNSUPPORTED = 'frame_unsupported'
No docstring is defined in the source.
aip_sdk.traces.TraceDropReason.HANDLER_ERROR
aip_sdk.traces.TraceDropReason.HANDLER_ERROR = 'handler_error'
No docstring is defined in the source.
aip_sdk.traces.TraceDropReason.NO_CONVENTION
aip_sdk.traces.TraceDropReason.NO_CONVENTION = 'no_convention'
No docstring is defined in the source.
aip_sdk.traces.TraceDropReason.NO_HANDLER
aip_sdk.traces.TraceDropReason.NO_HANDLER = 'no_handler'
No docstring is defined in the source.
aip_sdk.traces.TraceDropRecord
aip_sdk.traces.TraceDropRecord
A single input record that failed to land, with the stage and reason it was dropped.
stage and reason are closed enumerations — match on a member rather than
comparing strings, though both are StrEnum\ s so an existing string
comparison keeps working. record_id can be None at
TraceDropStage.PULL, where a record may be lost before it is identifiable —
source_uri names where it came from and is the only handle on it.
aip_sdk.traces.TraceDropRecord.detail
aip_sdk.traces.TraceDropRecord.detail: str = ''
No docstring is defined in the source.
aip_sdk.traces.TraceDropRecord.model_config
aip_sdk.traces.TraceDropRecord.model_config = ConfigDict(extra='allow')
No docstring is defined in the source.
aip_sdk.traces.TraceDropRecord.reason
aip_sdk.traces.TraceDropRecord.reason: TraceDropReason
No docstring is defined in the source.
aip_sdk.traces.TraceDropRecord.record_id
aip_sdk.traces.TraceDropRecord.record_id: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceDropRecord.source_uri
aip_sdk.traces.TraceDropRecord.source_uri: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceDropRecord.stage
aip_sdk.traces.TraceDropRecord.stage: TraceDropStage
No docstring is defined in the source.
aip_sdk.traces.TraceDropStage
aip_sdk.traces.TraceDropStage
The boundary a record was dropped at.
PULL is reading the source data, before a record is recognised as a span — so a pull
drop is attributable to a source object rather than to a record id. CONVERT is
mapping a recognised record onto the canonical trace model, one record at a time.
aip_sdk.traces.TraceDropStage.CONVERT
aip_sdk.traces.TraceDropStage.CONVERT = 'convert'
No docstring is defined in the source.
aip_sdk.traces.TraceDropStage.PULL
aip_sdk.traces.TraceDropStage.PULL = 'pull'
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruth
aip_sdk.traces.TraceGroundTruth
The ground truth a dataset version carries.
columns and row_count describe the whole artifact rather than the returned page,
so checking which columns a version carries never requires paging.
aip_sdk.traces.TraceGroundTruth.columns
aip_sdk.traces.TraceGroundTruth.columns: list[str] = Field(default_factory=list[str])
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruth.dataset_version_id
aip_sdk.traces.TraceGroundTruth.dataset_version_id: str
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruth.model_config
aip_sdk.traces.TraceGroundTruth.model_config = ConfigDict(extra='allow')
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruth.row_count
aip_sdk.traces.TraceGroundTruth.row_count: int = 0
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruth.rows
aip_sdk.traces.TraceGroundTruth.rows: list[TraceGroundTruthRow] = Field(default_factory=list[TraceGroundTruthRow])
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthRow
aip_sdk.traces.TraceGroundTruthRow
One annotated identifier and the ground-truth values attached to it.
Each values entry is the stored cell as the artifact encodes it — a JSON-encoded
list, so a column attached as ["search"] reads back as '["search"]'; decode it
with json.loads() rather than comparing against the list that was attached.
aip_sdk.traces.TraceGroundTruthRow.model_config
aip_sdk.traces.TraceGroundTruthRow.model_config = ConfigDict(extra='allow')
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthRow.parent_id
aip_sdk.traces.TraceGroundTruthRow.parent_id: str
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthRow.values
aip_sdk.traces.TraceGroundTruthRow.values: dict[str, str] = Field(default_factory=dict[str, str])
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion
aip_sdk.traces.TraceGroundTruthVersion
The version derived by attaching ground truth to a landed trace version.
dataset_version_id is a new version and the base is left untouched, and a migrated
evaluation target gets a new ID — so scope everything downstream to
dataset_version_id and migrated_partitions[].partition_id.
aip_sdk.traces.TraceGroundTruthVersion.base_dataset_version_id
aip_sdk.traces.TraceGroundTruthVersion.base_dataset_version_id: str
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.created_at
aip_sdk.traces.TraceGroundTruthVersion.created_at: datetime | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.dataset_id
aip_sdk.traces.TraceGroundTruthVersion.dataset_id: str
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.dataset_version_id
aip_sdk.traces.TraceGroundTruthVersion.dataset_version_id: str
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.ground_truth_columns
aip_sdk.traces.TraceGroundTruthVersion.ground_truth_columns: list[str] = Field(default_factory=list[str])
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.ground_truth_path
aip_sdk.traces.TraceGroundTruthVersion.ground_truth_path: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.ground_truth_row_count
aip_sdk.traces.TraceGroundTruthVersion.ground_truth_row_count: int
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.migrated_id
aip_sdk.traces.TraceGroundTruthVersion.migrated_id(partition_id: str) -> str
The id partition_id (from the base version) now has on this derived version.
Replaces inverting migrated_partitions into a lookup dict by hand for the
common case of resolving one specific partition you already hold a reference to.
Parameters
partition_idstr: A partition id from the versionbase_dataset_version_idcarried, to resolve onto this derived version.
Returns
str: The migrated id, ready to use ondataset_version_id.
Raises
NotFoundError: Ifpartition_iddid not follow onto this version — either it was never one of the base's partitions, or it hit a name collision (the reason is included in the message).
aip_sdk.traces.TraceGroundTruthVersion.migrated_partitions
aip_sdk.traces.TraceGroundTruthVersion.migrated_partitions: list[PartitionMigrationOutcome] = Field(default_factory=list[PartitionMigrationOutcome])
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.model_config
aip_sdk.traces.TraceGroundTruthVersion.model_config = ConfigDict(extra='allow')
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.object_store_path
aip_sdk.traces.TraceGroundTruthVersion.object_store_path: str | None = Field(default=None, validation_alias='minio_path')
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.replayed
aip_sdk.traces.TraceGroundTruthVersion.replayed: bool = False
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.row_count
aip_sdk.traces.TraceGroundTruthVersion.row_count: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.stage
aip_sdk.traces.TraceGroundTruthVersion.stage: str
No docstring is defined in the source.
aip_sdk.traces.TraceGroundTruthVersion.unmigrated_partitions
aip_sdk.traces.TraceGroundTruthVersion.unmigrated_partitions: list[PartitionMigrationOutcome]
The evaluation targets that did not follow the ground truth onto this version.
Empty in the ordinary case; a non-empty list is the only part of
migrated_partitions needing action, and each entry's reason says what.
aip_sdk.traces.TraceGroundTruthVersion.version
aip_sdk.traces.TraceGroundTruthVersion.version: int
No docstring is defined in the source.
aip_sdk.traces.TraceIngestDropPage
aip_sdk.traces.TraceIngestDropPage
One page of an ingestion run's drop records, and how many of its drops can be read.
total_drops is how many records the run dropped; available is how many of them
this endpoint can return. The two differ only for a run that landed nothing, which keeps
a capped sample of each drop reason rather than every record — so available below
total_drops means the drops you can read are examples, not the full set. items is
the page itself, bounded by the limit you asked for.
aip_sdk.traces.TraceIngestDropPage.available
aip_sdk.traces.TraceIngestDropPage.available: int
No docstring is defined in the source.
aip_sdk.traces.TraceIngestDropPage.items
aip_sdk.traces.TraceIngestDropPage.items: list[TraceDropRecord]
No docstring is defined in the source.
aip_sdk.traces.TraceIngestDropPage.model_config
aip_sdk.traces.TraceIngestDropPage.model_config = ConfigDict(extra='allow')
No docstring is defined in the source.
aip_sdk.traces.TraceIngestDropPage.total_drops
aip_sdk.traces.TraceIngestDropPage.total_drops: int
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun
aip_sdk.traces.TraceIngestRun
The status and outcome of a trace-ingestion run.
run_status reports coarse progress and state the stage reached; check
is_terminal rather than comparing them by hand. dataset_id and
dataset_version_id are populated once the run has landed rows, and the drop
counters break down how many input records were dropped and at which stage.
The drop counters say whether every record landed. The content counts describe where
canonical content fields were populated among the records that did land, which the drop
counters cannot express: a landing can have zero drops and still have no message, tool-call
or document values anywhere in a trace. content_diagnostics states those observations
in prose:
run = aip.land_traces(payloads, ingest_convention="openinference").wait_until_terminal()
for observation in run.content_diagnostics:
print(observation)
These are descriptive, not a verdict. spans_without_content is routinely non-zero on a
healthy trace, since a parent span often carries topology while its children carry the
prompt and response; spans_with_unknown_kind counts spans no agent convention
describes, such as HTTP or client instrumentation. To learn whether a specific metric can
score a target, call get_partition_metric_availability().
The counts are None on runs that landed before they were measured, which is not the
same as zero — an empty content_diagnostics alone does not distinguish "nothing to
note" from "never measured", so check a count for None when that difference matters.
aip_sdk.traces.TraceIngestRun.buffer_id
aip_sdk.traces.TraceIngestRun.buffer_id: str
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.completed_at
aip_sdk.traces.TraceIngestRun.completed_at: datetime | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.content_diagnostics
aip_sdk.traces.TraceIngestRun.content_diagnostics: list[str] = Field(default_factory=list[str])
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.content_traces
aip_sdk.traces.TraceIngestRun.content_traces: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.convert_drops
aip_sdk.traces.TraceIngestRun.convert_drops: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.created_at
aip_sdk.traces.TraceIngestRun.created_at: datetime | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.dataset_id
aip_sdk.traces.TraceIngestRun.dataset_id: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.dataset_version_id
aip_sdk.traces.TraceIngestRun.dataset_version_id: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.drop_path
aip_sdk.traces.TraceIngestRun.drop_path: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.error
aip_sdk.traces.TraceIngestRun.error: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.failed
aip_sdk.traces.TraceIngestRun.failed: bool
Whether the run finished unsuccessfully. error carries the reason.
aip_sdk.traces.TraceIngestRun.id
aip_sdk.traces.TraceIngestRun.id: str
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.is_terminal
aip_sdk.traces.TraceIngestRun.is_terminal: bool
Whether the run has finished, successfully or not, and will not change again.
aip_sdk.traces.TraceIngestRun.iter_drops
aip_sdk.traces.TraceIngestRun.iter_drops(*, page_size: int = 500, client: APIClient | None = None) -> Iterator[TraceDropRecord]
Iterate every record this run failed to land, reading each drop's detail.
Pages are fetched lazily as the iterator is consumed, so a run that dropped as many
records as it read is never materialised in full. A run that landed nothing yields a
capped sample per drop reason rather than every record — compare what you consumed
against total_drops, or call list_drops() for the two counts directly.
Parameters
page_sizeint: Records to fetch per request (1 toMAX_DROPS_PER_PAGE). Affects only request granularity, not the records yielded.clientAPIClient | None: Optional API client. Defaults to whichever client fetched or created this run, not the session default.
Yields
TraceDropRecord: Each readable drop record for the run, oldest first.
Raises
InvalidArgumentError: Ifpage_sizeis out of range.AuthError: If credentials are missing or invalid.NotFoundError: If the run does not exist, or belongs to a workspace the caller is not a member of.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.TraceIngestRun.landed_rows
aip_sdk.traces.TraceIngestRun.landed_rows: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.last_successful_state
aip_sdk.traces.TraceIngestRun.last_successful_state: TraceIngestState
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.list_drops
aip_sdk.traces.TraceIngestRun.list_drops(*, limit: int = 200, offset: int = 0, client: APIClient | None = None) -> TraceIngestDropPage
Read one page of the records this run failed to land.
Works whether or not the run landed a version, so it is what to reach for when
failed is true and there is no dataset_version_id to read drops by.
Prefer iter_drops() to walk every drop without paging by hand.
Parameters
limitint: Maximum records to return (1 toMAX_DROPS_PER_PAGE).offsetint: Number of records to skip, for pagination.clientAPIClient | None: Optional API client. Defaults to whichever client fetched or created this run, not the session default.
Returns
TraceIngestDropPage: The page, alongside how many drops the run has and how many can be read.
Raises
InvalidArgumentError: Iflimitoroffsetis out of range.AuthError: If credentials are missing or invalid.NotFoundError: If the run does not exist, or belongs to a workspace the caller is not a member of.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.TraceIngestRun.model_config
aip_sdk.traces.TraceIngestRun.model_config = ConfigDict(extra='allow')
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.object_store_path
aip_sdk.traces.TraceIngestRun.object_store_path: str | None = Field(default=None, validation_alias='minio_path')
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.project_id
aip_sdk.traces.TraceIngestRun.project_id: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.pull_drops
aip_sdk.traces.TraceIngestRun.pull_drops: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.run_status
aip_sdk.traces.TraceIngestRun.run_status: TraceIngestStatus
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.spans_with_unknown_kind
aip_sdk.traces.TraceIngestRun.spans_with_unknown_kind: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.spans_without_content
aip_sdk.traces.TraceIngestRun.spans_without_content: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.state
aip_sdk.traces.TraceIngestRun.state: TraceIngestState
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.sut_id
aip_sdk.traces.TraceIngestRun.sut_id: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.total_drops
aip_sdk.traces.TraceIngestRun.total_drops: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.total_in
aip_sdk.traces.TraceIngestRun.total_in: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.traces_without_content
aip_sdk.traces.TraceIngestRun.traces_without_content: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestRun.wait_until_terminal
aip_sdk.traces.TraceIngestRun.wait_until_terminal(*, interval: float = 1.0, timeout: float = 60.0, client: APIClient | None = None) -> TraceIngestRun
Poll this run until it reaches a terminal state.
Parameters
intervalfloat: Seconds between polls.timeoutfloat: Maximum seconds to wait.clientAPIClient | None: Optional API client. Defaults to whichever client fetched or created this run (e.g. the one passed toland_traces()), not the session default — pass one explicitly only to poll with a different client.
Returns
TraceIngestRun: The run onceis_terminalis true — checkfailedfor theTraceIngestRun: outcome, since a terminal run is not necessarily a successful one.
Raises
TimeoutError: If the run has not reached a terminal state withintimeout.AuthError: If credentials are missing or invalid.NotFoundError: If the run does not exist, or belongs to a workspace the caller is not a member of.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.TraceIngestRun.workspace_id
aip_sdk.traces.TraceIngestRun.workspace_id: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceIngestState
aip_sdk.traces.TraceIngestState
The stage a trace-ingestion run has durably reached.
A run advances PENDING → BUFFERED → CONVERTED → COMPLETED; a retry
resumes from the last stage it completed rather than repeating finished work.
aip_sdk.traces.TraceIngestState.BUFFERED
aip_sdk.traces.TraceIngestState.BUFFERED = 'BUFFERED'
No docstring is defined in the source.
aip_sdk.traces.TraceIngestState.COMPLETED
aip_sdk.traces.TraceIngestState.COMPLETED = 'COMPLETED'
No docstring is defined in the source.
aip_sdk.traces.TraceIngestState.CONVERTED
aip_sdk.traces.TraceIngestState.CONVERTED = 'CONVERTED'
No docstring is defined in the source.
aip_sdk.traces.TraceIngestState.FAILED
aip_sdk.traces.TraceIngestState.FAILED = 'FAILED'
No docstring is defined in the source.
aip_sdk.traces.TraceIngestState.PENDING
aip_sdk.traces.TraceIngestState.PENDING = 'PENDING'
No docstring is defined in the source.
aip_sdk.traces.TraceIngestStatus
aip_sdk.traces.TraceIngestStatus
Coarse progress of a trace-ingestion run.
aip_sdk.traces.TraceIngestStatus.COMPLETED
aip_sdk.traces.TraceIngestStatus.COMPLETED = 'COMPLETED'
No docstring is defined in the source.
aip_sdk.traces.TraceIngestStatus.FAILED
aip_sdk.traces.TraceIngestStatus.FAILED = 'FAILED'
No docstring is defined in the source.
aip_sdk.traces.TraceIngestStatus.PENDING
aip_sdk.traces.TraceIngestStatus.PENDING = 'PENDING'
No docstring is defined in the source.
aip_sdk.traces.TraceIngestStatus.RUNNING
aip_sdk.traces.TraceIngestStatus.RUNNING = 'RUNNING'
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection
aip_sdk.traces.TraceSourceConnection
A saved object-store connection traces can be pulled from.
Credential fields (access_key, secret_key, auth_header_value) are
write-only: the platform masks them in responses, and they are additionally kept
out of this object's repr so a credential can never surface in a log or
traceback even if a response echoed one.
unusable_reason states why the connection's source is not one the platform may pull
from — most often a bucket or prefix that was never allowed, on a connection
saved before the platform validated the source at creation. It is None for a usable
connection, and against a platform that validates at creation it is None on
everything create_source_connection() returns. The remedy is to create a
replacement naming an allowed source; the string is human-facing diagnostic text and its
wording is not a contract to parse.
aip_sdk.traces.TraceSourceConnection.access_key
aip_sdk.traces.TraceSourceConnection.access_key: str | None = Field(default=None, repr=False)
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.auth_header_name
aip_sdk.traces.TraceSourceConnection.auth_header_name: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.auth_header_value
aip_sdk.traces.TraceSourceConnection.auth_header_value: str | None = Field(default=None, repr=False)
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.auth_type
aip_sdk.traces.TraceSourceConnection.auth_type: str
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.bucket
aip_sdk.traces.TraceSourceConnection.bucket: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.config
aip_sdk.traces.TraceSourceConnection.config: dict[str, Any] = Field(default_factory=dict)
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.created_at
aip_sdk.traces.TraceSourceConnection.created_at: datetime | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.endpoint
aip_sdk.traces.TraceSourceConnection.endpoint: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.id
aip_sdk.traces.TraceSourceConnection.id: str
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.label
aip_sdk.traces.TraceSourceConnection.label: str
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.model_config
aip_sdk.traces.TraceSourceConnection.model_config = ConfigDict(extra='allow')
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.prefix
aip_sdk.traces.TraceSourceConnection.prefix: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.project_id
aip_sdk.traces.TraceSourceConnection.project_id: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.region
aip_sdk.traces.TraceSourceConnection.region: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.retention_days
aip_sdk.traces.TraceSourceConnection.retention_days: int | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.secret_key
aip_sdk.traces.TraceSourceConnection.secret_key: str | None = Field(default=None, repr=False)
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.secure
aip_sdk.traces.TraceSourceConnection.secure: bool = True
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.source_type
aip_sdk.traces.TraceSourceConnection.source_type: str
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.sut_id
aip_sdk.traces.TraceSourceConnection.sut_id: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.unusable_reason
aip_sdk.traces.TraceSourceConnection.unusable_reason: str | None = None
No docstring is defined in the source.
aip_sdk.traces.TraceSourceConnection.workspace_id
aip_sdk.traces.TraceSourceConnection.workspace_id: str | None = None
No docstring is defined in the source.
aip_sdk.traces.attach_ground_truth
aip_sdk.traces.attach_ground_truth(version_id: str, file: str | Path | None = None, *, rows: Mapping[str, Mapping[str, Sequence[str]]] | None = None, data: bytes | None = None, filename: str | None = None, client: APIClient | None = None) -> TraceGroundTruthVersion
Attach ground truth to a landed trace version, deriving a new version from it.
Supply the ground truth exactly one way: file (a path to a .csv/.json/
.jsonl file), rows (an in-memory mapping), or data (raw bytes, which needs
filename so the platform can read the format from its extension).
The base version is never mutated — the returned dataset_version_id is a new version
carrying the ground truth, and it takes over as the version metrics score when the base
was that version. Evaluation targets defined on the base are carried across with new
IDs, reported per target in migrated_partitions.
Retries must re-submit against the same version_id as the first attempt: replay
is keyed on the base, so re-uploading the same file against the version it just derived
is a different request that merges to a no-op and still derives a version. Record the
returned dataset_version_id as the result rather than using it as the next upload
target.
Parameters
version_idstr: Dataset version to attach the ground truth to.filestr | Path | None: Path to the ground-truth file, keyed bysession_id(ortrace_id).rowsMapping[str, Mapping[str, Sequence[str]]] | None: Ground truth asidentifier -> column -> values, serialised for you.databytes | None: Ground-truth file content, for a file you have already read or built.filenamestr | None: Name fordata, whose extension selects the format. Required withdataand rejected withfile/rows.clientAPIClient | None: Optional API client.
Returns
TraceGroundTruthVersion: The derived version, its ground-truth columns, and what became of each of theTraceGroundTruthVersion: base's evaluation targets.
Raises
InvalidArgumentError: If the ground truth is supplied more than one way or not at all,filenameis missing or misplaced, arowsvalue is not a list of strings, the file cannot be read, or the format is not one ofGROUND_TRUTH_FILE_SUFFIXES.AuthError: If credentials are missing or invalid.ForbiddenError: If the caller lacks editor rights on the version's workspace.NotFoundError: If the dataset version does not exist.UnprocessableEntityError: If the platform rejects the file — over the size limit, malformed, or keyed against identifiers this version does not have.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.create_source_connection
aip_sdk.traces.create_source_connection(*, bucket: str, label: str = 'default', workspace_id: str | None = None, project_id: str | None = None, sut_id: str | None = None, prefix: str | None = None, endpoint: str | None = None, access_key: str | None = None, secret_key: str | None = None, secure: bool = True, region: str | None = None, retention_days: int | None = None, client: APIClient | None = None) -> TraceSourceConnection
Create a saved object-store connection traces can be pulled from.
An object store authenticates with an access_key/secret_key pair, which must be
supplied together and only alongside an endpoint. Omit endpoint to pull from a
bucket the platform is already configured for, in which case no per-connection
credential or region applies. Credentials are stored write-only and are never
returned in plaintext.
Parameters
bucketstr: Object-store bucket to pull from.labelstr: Human-readable label for the connection, unique within the workspace or project it is scoped to.workspace_idstr | None: Workspace the connection belongs to. If omitted andproject_idis also omitted, falls back to the client's configured default workspace (aip.init(workspace_id=...)/AIP_WORKSPACE_ID). Pass this orproject_id, not both: a project already determines its workspace.project_idstr | None: System-under-test's workspace project the connection is associated with.sut_idstr | None: System-under-test the pulled traces are attributed to.prefixstr | None: Key prefix within the bucket to scope the pull.endpointstr | None: External object-store host, ashostorhost:port— without a scheme, path, or credentials. Omit it to pull from a platform-configured bucket.access_keystr | None: Object-store access key (write-only). Requiresendpointandsecret_key.secret_keystr | None: Object-store secret key (write-only). Requiresendpointandaccess_key.securebool: Whether to connect toendpointover HTTPS.regionstr | None: Object-store region. Requiresendpoint.retention_daysint | None: Retention window for pulled data — one ofRETENTION_DAYS. WhenNone, the platform default applies.clientAPIClient | None: Optional API client.
Returns
TraceSourceConnection: The created connection, with credential fields masked.
Raises
NoWorkspaceSelectedError: If no workspace is passed and none is configured for the session.InvalidArgumentError: Ifbucketis empty,retention_daysis not a supported window, only one ofaccess_key/secret_keyis given, a credential orregionis given without anendpoint, or bothproject_idandworkspace_idare given — a project already determines its workspace.AuthError: If credentials are missing or invalid.ForbiddenError: Ifbucket,prefix, orendpointnames a source the platform may not pull from; the message names the constraint and the values that would satisfy it, so no connection is saved that cannot be landed from. Also raised, with an access message instead, if the caller lacks rights to create a connection in the workspace.ConflictError: If a connection with thislabelalready exists in the same scope.UnprocessableEntityError: If the connection configuration is rejected by the platform.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.get_ground_truth
aip_sdk.traces.get_ground_truth(version_id: str, *, limit: int = 200, offset: int = 0, client: APIClient | None = None) -> TraceGroundTruth
Read the ground truth a dataset version carries.
columns and row_count always describe the whole artifact, so read
TraceGroundTruthVersion.ground_truth_columns or these fields to learn which columns
exist rather than paging; prefer iter_ground_truth() to walk every row.
Parameters
version_idstr: Dataset version to read.limitint: Maximum annotated identifiers to return (1 toMAX_GROUND_TRUTH_ROWS_PER_PAGE).offsetint: Number of identifiers to skip, for pagination.clientAPIClient | None: Optional API client.
Returns
TraceGroundTruth: The version's ground truth, with one page of rows ordered by identifier. A versionTraceGroundTruth: with none attached returns emptycolumnsandrowsrather than raising.
Raises
InvalidArgumentError: Iflimitoroffsetis out of range.AuthError: If credentials are missing or invalid.NotFoundError: If the dataset version does not exist, or belongs to a workspace the caller is not a member of.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.get_ingest_run
aip_sdk.traces.get_ingest_run(run_id: str, *, client: APIClient | None = None) -> TraceIngestRun
Fetch the current status of a trace-ingestion run.
Parameters
run_idstr: The ingestion run ID returned byland_traces().clientAPIClient | None: Optional API client.
Returns
TraceIngestRun: The ingestion run, including its latestrun_statusand landed dataset version.
Raises
AuthError: If credentials are missing or invalid.NotFoundError: If the run does not exist, or belongs to a workspace the caller is not a member of.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.iter_ground_truth
aip_sdk.traces.iter_ground_truth(version_id: str, *, page_size: int = 500, client: APIClient | None = None) -> Iterator[TraceGroundTruthRow]
Iterate every annotated identifier on a dataset version.
Pages are fetched lazily as the iterator is consumed, so no page is held beyond the rows yielded from it. This bounds each response, not the platform's own read — the artifact is decoded whole to serve any page, and the upload size limit is what keeps that bounded.
Parameters
version_idstr: Dataset version to read.page_sizeint: Identifiers to fetch per request (1 toMAX_GROUND_TRUTH_ROWS_PER_PAGE). Affects only request granularity.clientAPIClient | None: Optional API client.
Yields
TraceGroundTruthRow: Each annotated identifier and its values, ordered by identifier.
Raises
InvalidArgumentError: Ifpage_sizeis out of range.AuthError: If credentials are missing or invalid.NotFoundError: If the dataset version does not exist, or belongs to a workspace the caller is not a member of.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.iter_ingest_drops
aip_sdk.traces.iter_ingest_drops(version_id: str, *, page_size: int = 500, client: APIClient | None = None) -> Iterator[TraceDropRecord]
Iterate every record dropped while landing traces into a dataset version.
Pages are fetched lazily as the iterator is consumed, so a version with many drops is never materialised in full. A failed ingestion can drop as many records as it read, which is why this is the default way to read them.
Parameters
version_idstr: Dataset version ID the ingestion run landed into.page_sizeint: Records to fetch per request (1 toMAX_DROPS_PER_PAGE). Affects only request granularity, not the records yielded.clientAPIClient | None: Optional API client.
Yields
TraceDropRecord: Each drop record for the version, oldest first.
Raises
InvalidArgumentError: Ifpage_sizeis out of range.AuthError: If credentials are missing or invalid.NotFoundError: If the dataset version does not exist, or belongs to a workspace the caller is not a member of.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.land_traces
aip_sdk.traces.land_traces(payloads: list[dict[str, Any]], *, workspace_id: str | None = None, project_id: str | None = None, sut_id: str | None = None, ingest_convention: str | None = None, dataset_name: str | None = None, dataset_id: str | None = None, buffer_id: str | None = None, retention_days: int | None = None, trace_tags: Iterable[TagInput] | None = None, client: APIClient | None = None) -> TraceIngestRun
Trigger ingestion of inline trace payloads into a dataset.
Landing is asynchronous: this returns as soon as the run is accepted. Call
TraceIngestRun.wait_until_terminal() on the result (or poll
get_ingest_run() by hand) until run_status is terminal to learn the
dataset version the traces landed in.
Parameters
payloadslist[dict[str, Any]]: The raw trace payloads to ingest (e.g. OpenInference/gen_ai/LangSmith spans). Must be non-empty.workspace_idstr | None: Workspace to land the traces in. If omitted andproject_idis also omitted, falls back to the client's configured default workspace (aip.init(workspace_id=...)/AIP_WORKSPACE_ID). Pass this orproject_id, not both: a project already determines its workspace.project_idstr | None: Project to associate the landed dataset with.sut_idstr | None: System-under-test the traces were produced by.ingest_conventionstr | None: Source convention to convert the payloads as — one ofINGEST_CONVENTIONS, the set this SDK version knows. Naming it overrides detection, so a payload that is not in that convention is dropped rather than re-sniffed. Leave itNoneto auto-detect per record, which also handles a convention newer than this SDK version.dataset_namestr | None: Name for a new dataset to create for these traces.dataset_idstr | None: Existing dataset to append the traces to, instead of creating one.buffer_idstr | None: Idempotency key, scoped to the resolvedworkspace_id. Re-landing with the key of a completed run in the same workspace replays that run's outcome instead of duplicating rows; re-landing while the first run is still in flight raisesConflictError. Reusing abuffer_idacross a change in which workspace it resolves to (e.g. settingAIP_WORKSPACE_IDfor the first time) does not replay the earlier run, since the pair no longer matches.retention_daysint | None: Retention window for the raw landed data — one ofRETENTION_DAYS. WhenNone, the platform default applies.trace_tagsIterable[TagInput] | None: Optional trace tags to attach to the landed traces, asTraceTagUpsertinstances or equivalent dicts.clientAPIClient | None: Optional API client.
Returns
TraceIngestRun: The accepted ingestion run.
Raises
NoWorkspaceSelectedError: If no workspace is passed and none is configured for the session.InvalidArgumentError: Ifpayloadsis empty,ingest_conventionis not a recognised convention,retention_daysis not a supported window, antrace_tagsentry is malformed or the per-request limit is exceeded, or bothproject_idandworkspace_idare given — a project already determines its workspace.AuthError: If credentials are missing or invalid.ForbiddenError: Ifworkspace_id(or the configured default) names a workspace the caller is not a member of.NotFoundError: Ifdataset_idnames no dataset in the landing workspace or project.APIError: Ifproject_idnames no project in a workspace the caller belongs to.ConflictError: If a run forbuffer_idis already in flight.UnprocessableEntityError: If the payloads or arguments are rejected by the platform.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.land_traces_from_connection
aip_sdk.traces.land_traces_from_connection(connection_id: str, *, client: APIClient | None = None) -> TraceIngestRun
Trigger ingestion by pulling traces from a saved object-store connection.
Parameters
connection_idstr: ID of the source connection to pull from.clientAPIClient | None: Optional API client.
Returns
TraceIngestRun: The accepted ingestion run. CallTraceIngestRun.wait_until_terminal()forTraceIngestRun: its outcome.
Raises
NotFoundError: If the connection does not exist, or belongs to a workspace the caller is not a member of.AuthError: If credentials are missing or invalid.ForbiddenError: If the connection's source is not one the platform may pull from; itsunusable_reasoninlist_source_connections()says why.UnprocessableEntityError: If the connection cannot be used to pull traces.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.list_ingest_drops
aip_sdk.traces.list_ingest_drops(version_id: str, *, limit: int = 200, offset: int = 0, client: APIClient | None = None) -> list[TraceDropRecord]
List the records dropped while landing traces into a dataset version.
Prefer iter_ingest_drops() to walk every drop without paging by hand.
Parameters
version_idstr: Dataset version ID the ingestion run landed into.limitint: Maximum records to return (1 toMAX_DROPS_PER_PAGE).offsetint: Number of records to skip, for pagination.clientAPIClient | None: Optional API client.
Returns
list[TraceDropRecord]: One page of drop records for the version, oldest first. A page shorter thanlist[TraceDropRecord]:limitmeans there are no further records.
Raises
InvalidArgumentError: Iflimitoroffsetis out of range.AuthError: If credentials are missing or invalid.NotFoundError: If the dataset version does not exist, or belongs to a workspace the caller is not a member of.ResponseParseError: If the platform's response does not match this SDK version.
aip_sdk.traces.list_source_connections
aip_sdk.traces.list_source_connections(*, client: APIClient | None = None, workspace_id: str | None = None, all_workspaces: bool = False) -> list[TraceSourceConnection]
List saved object-store connections traces can be pulled from.
Reads your session's workspace unless you name one, and raises if none is set.
Pass all_workspaces=True to read across every workspace you can access.
Parameters
clientAPIClient | None: Optional API client.workspace_idstr | None: Return only connections saved in this workspace.all_workspacesbool: Read across every workspace you can access.
Returns
list[TraceSourceConnection]: The available source connections, with credential fields masked.
Raises
InvalidArgumentError: If bothworkspace_idandall_workspacesare given.AuthError: If credentials are missing or invalid.ForbiddenError: Ifworkspace_idnames a workspace you cannot access.ResponseParseError: If the platform's response does not match this SDK version.NoWorkspaceSelectedError: No workspace was passed, none is configured for the session, andall_workspaceswas not set.
aip_sdk.traces.promote_trace_version
aip_sdk.traces.promote_trace_version(version_id: str, *, client: APIClient | None = None) -> TraceCurrentVersion
Choose which version of a trace dataset its metrics score, stepping back whichever was.
Attaching ground truth already hands currency to the version it derives, so this is for the cases that are not that — going back to the un-annotated version, or selecting a derivation built from a version that was not current at the time.
Parameters
version_idstr: Dataset version to make current.clientAPIClient | None: Optional API client.
Returns
TraceCurrentVersion: The version metrics now score.
Raises
AuthError: If credentials are missing or invalid.ForbiddenError: If the caller lacks editor rights on the version's workspace.NotFoundError: If the dataset version does not exist.UnprocessableEntityError: If the version is not an agent-trace version, or is already the version metrics score.ResponseParseError: If the platform's response does not match this SDK version.