Back to Pi Mono

Pi Agent Telemetry Schemas

packages/agent/docs/telemetry-schema.md

0.84.012.7 KB
Original Source

Pi Agent Telemetry Schemas

<!-- Generated by generate-telemetry-docs.ts. Do not edit manually. -->

AI request schema

Schema version: 1

pi.ai.request

One logical request to an AI provider

  • Parents: root or any caller span
  • Default status: ok
  • Error when: The operation throws or returns an error result

Start attributes

NameTypeRequiredValuesNotesDescription
pi.ai.operationstringyesstream, fetch_deferred, cancel_deferred, generate_imagesLogical provider operation
pi.ai.providerstringyesSelected provider id
pi.ai.modelstringyesRequested model id
pi.ai.apistringyesProvider API id
pi.ai.streamingbooleanyesWhether this operation returns a stream
pi.ai.deferredbooleannoWhether the operation requests or participates in deferred execution

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
pi.ai.response.modelstringConcrete response model
pi.ai.response.idstringhigh cardinalityProvider response id
pi.ai.response.stop_reasonstringstop, length, tool_use, error, aborted, deferredNormalized terminal response reason
pi.ai.http.status_codenumberFinal HTTP status
pi.ai.usage.input_tokensnumberReported input tokens
pi.ai.usage.output_tokensnumberReported output tokens
pi.ai.usage.cache_read_tokensnumberReported cache-read tokens
pi.ai.usage.cache_write_tokensnumberReported cache-write tokens
pi.ai.usage.reasoning_tokensnumberReported reasoning tokens
pi.ai.usage.total_tokensnumberReported total tokens
pi.ai.usage.costnumberReported total cost
pi.ai.stream.chunk_countnumberStreamed update chunk count
pi.ai.stream.time_to_first_chunk_msnumberElapsed milliseconds to first update chunk
pi.ai.error.typestringlow cardinalityProvider or transport error class

Events

No declared span events.

Harness schema

Schema version: 1

pi.harness.run

One admitted in-process run invocation

  • Parents: root or caller-owned external span
  • Default status: ok
  • Error when: The run fails or throws

Start attributes

NameTypeRequiredValuesNotesDescription
pi.session.idstringyeshigh cardinalitySession id
pi.lane.namestringyeshigh cardinalityLane name
pi.operation.idstringyeshigh cardinalityDurable operation id
pi.operation.recoverybooleanyesWhether this invocation resumes durable work
pi.operation.kindstringyesrunRun operation kind

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
pi.operation.outcomestringcompleted, aborted, failed, suspendedRun invocation outcome
pi.error.codestringlow cardinalityStable operation error code
pi.error.typestringlow cardinalityLow-cardinality operation error class

Events

No declared span events.

pi.harness.compaction

One admitted in-process manual compaction invocation

  • Parents: root or caller-owned external span
  • Default status: ok
  • Error when: The compaction fails or throws

Start attributes

NameTypeRequiredValuesNotesDescription
pi.session.idstringyeshigh cardinalitySession id
pi.lane.namestringyeshigh cardinalityLane name
pi.operation.idstringyeshigh cardinalityDurable operation id
pi.operation.recoverybooleanyesWhether this invocation resumes durable work
pi.operation.kindstringyescompactionCompaction operation kind

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
pi.operation.outcomestringcompleted, declined, aborted, failedCompaction invocation outcome
pi.error.codestringlow cardinalityStable operation error code
pi.error.typestringlow cardinalityLow-cardinality operation error class

Events

No declared span events.

pi.harness.navigation

One admitted in-process navigation invocation

  • Parents: root or caller-owned external span
  • Default status: ok
  • Error when: The navigation fails or throws

Start attributes

NameTypeRequiredValuesNotesDescription
pi.session.idstringyeshigh cardinalitySession id
pi.lane.namestringyeshigh cardinalityLane name
pi.operation.idstringyeshigh cardinalityDurable operation id
pi.operation.recoverybooleanyesWhether this invocation resumes durable work
pi.operation.kindstringyesnavigationNavigation operation kind

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
pi.operation.outcomestringcompleted, declined, aborted, failedNavigation invocation outcome
pi.error.codestringlow cardinalityStable operation error code
pi.error.typestringlow cardinalityLow-cardinality operation error class

Events

No declared span events.

pi.harness.checkpoint

One run checkpoint

  • Parents: pi.harness.run
  • Default status: ok
  • Error when: Checkpoint work throws

Start attributes

NameTypeRequiredValuesNotesDescription
pi.lane.namestringyeshigh cardinalityLane name
pi.operation.idstringyeshigh cardinalityDurable operation id
pi.checkpoint.kindstringyesnormal, failure_drain, abort_reconcileCheckpoint purpose

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
none

Events

No declared span events.

pi.harness.turn

One assistant response and its tool batch

  • Parents: pi.harness.run
  • Default status: ok
  • Error when: Turn work throws

Start attributes

NameTypeRequiredValuesNotesDescription
pi.lane.namestringyeshigh cardinalityLane name
pi.operation.idstringyeshigh cardinalityDurable operation id
pi.turn.idstringyeshigh cardinalityInvocation-local turn id

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
none

Events

No declared span events.

pi.harness.step

One durable retry attempt

  • Parents: pi.harness.turn, pi.harness.checkpoint, pi.harness.compaction, pi.harness.navigation
  • Default status: ok
  • Error when: The attempt retries, fails, or throws

Start attributes

NameTypeRequiredValuesNotesDescription
pi.lane.namestringyeshigh cardinalityLane name
pi.operation.idstringyeshigh cardinalityDurable operation id
pi.step.kindstringyesassistant, compaction, branch_summaryRetryable step kind
pi.step.attemptnumberyesOne-based durable attempt number
pi.compaction.reasonstringnomanual, threshold, overflowCompaction trigger

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
pi.step.outcomestringsucceeded, retry, failed, aborted, deferred, overflowAttempt outcome

Events

No declared span events.

pi.harness.tool

One raw phase-2 tool execution

  • Parents: pi.harness.turn, pi.harness.run
  • Default status: ok
  • Error when: Raw phase-2 execution returns an error

Start attributes

NameTypeRequiredValuesNotesDescription
pi.lane.namestringyeshigh cardinalityLane name
pi.operation.idstringyeshigh cardinalityDurable operation id
pi.turn.idstringnohigh cardinalityInvocation-local live turn id
pi.tool.namestringyesTool name
pi.tool.call_idstringyeshigh cardinalityTool call id
pi.tool.replaystringyesnever, safeDeclared replay policy
pi.tool.recoverybooleanyesWhether this is recovery execution

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
pi.tool.is_errorbooleanWhether raw phase-2 execution returned an error

Events

No declared span events.

pi.harness.hook

One registered hook handler invocation

  • Parents: root or any caller span
  • Default status: ok
  • Error when: The handler throws

Start attributes

NameTypeRequiredValuesNotesDescription
pi.lane.namestringyeshigh cardinalityLane name
pi.operation.idstringnohigh cardinalityDurable operation id when accepted
pi.hook.namestringyesbefore_run, before_resume, before_run_end, transform_context, before_request, before_payload, after_response, before_tool, after_tool, before_compaction, before_navigationHook name
pi.hook.registration_idstringnoStable hook registration id

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
pi.hook.outcomestringcompleted, skipped, blocked, failedHandler outcome

Events

No declared span events.

pi.harness.sleep

One retry delay

  • Parents: pi.harness.step, pi.harness.run
  • Default status: ok
  • Error when: Sleep work throws

Start attributes

NameTypeRequiredValuesNotesDescription
pi.operation.idstringyeshigh cardinalityDurable operation id
pi.sleep.delay_msnumberyesRequested delay in milliseconds

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
pi.sleep.outcomestringelapsed, abortedDelay outcome

Events

No declared span events.

pi.harness.event_handler

One passive event listener invocation

  • Parents: root or any caller span
  • Default status: ok
  • Error when: The listener throws

Start attributes

NameTypeRequiredValuesNotesDescription
pi.event.typestringyesrun_start, run_resume, run_suspend, run_abort, run_end, fault, handler_error, turn_start, turn_end, retry_scheduled, retry_start, retry_end, message_start, message_update, message_end, tool_start, tool_update, tool_end, entry_added, write_pending, queue_update, fact_update, config_update, compaction_start, compaction_end, navigation_start, navigation_end, lane_created, usagelow cardinalityDelivered harness event type
pi.lane.namestringnohigh cardinalityLane name for lane-scoped events

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
none

Events

No declared span events.

pi.session.write

One committed session mutation

  • Parents: root or any caller span
  • Default status: ok
  • Error when: Storage rejects the mutation

Start attributes

NameTypeRequiredValuesNotesDescription
pi.lane.namestringyeshigh cardinalityLane name
pi.operation.idstringnohigh cardinalityDurable operation id when accepted
pi.session.mutationstringyesentry, record, lane, factSession mutation kind
pi.session.item_typestringnoEntry, record, lane, or fact subtype

End attributes

All end attributes are optional completion enrichment.

NameTypeValuesNotesDescription
pi.session.seqnumberCommitted session sequence when exposed

Events

No declared span events.