OpenTelemetry instrumentation for Oracle Open Agent Spec
(pyagentspec, import pyagentspec).
pip install traceAI-agentspecfrom fi_instrumentation import register
from traceai_agentspec import AgentSpecInstrumentor
AgentSpecInstrumentor().instrument(tracer_provider=register(project_name="my-project"))With fi-instrumentation-otel auto-instrumentation the agentspec integration is enabled whenever
pyagentspec is installed.
pyagentspec has its own tracing API: a runtime opens a Trace, and the spans and events it emits
are handed to the SpanProcessors of that trace. The instrumentor adds one such processor to every
Trace (the list you pass in is never modified; processors you add keep working) and translates the
spans and events into OpenTelemetry spans. Runtimes and adapters that emit pyagentspec spans
(for example WayFlow) are therefore traced without any change to your code. pyagentspec itself
makes no model calls, so there is no HTTP layer to instrument and nothing to double count.
pyagentspec span |
traceAI span | name |
|---|---|---|
AgentExecutionSpan, SwarmExecutionSpan, ManagerWorkersExecutionSpan |
AGENT |
agentspec.agent.<name> |
FlowExecutionSpan, NodeExecutionSpan |
CHAIN |
agentspec.flow.<name>, agentspec.node.<name> |
LlmGenerationSpan |
LLM |
agentspec.llm.<model id> |
ToolExecutionSpan |
TOOL |
agentspec.tool.<name> |
- The tree follows the
pyagentspecspan nesting; the outermost spans join the OpenTelemetry span that is active when theTracestarts. - LLM spans carry the provider, request model, temperature / top_p / max_tokens (and top_k, seed,
penalties when set), response id, token usage, the prompt and the response, and the tool calls the
model asked for. The endpoint URL and API key of the
LlmConfigare never exported. - A streamed generation is assembled from its chunk events; a stream that closes before the final
response is marked
agentspec.stream.incompleteand keeps the text received so far. - Exceptions are recorded as
ERRORwitherror.type(the class name); the message and stack trace thatpyagentspecrecords are never exported, and the exception is not touched. - Inputs and outputs follow the
TraceConfighide settings.pyagentspecmarks prompts, outputs and tool payloads as sensitive; passmask_sensitive_information=Truetoinstrument()to withhold all of them regardless ofTraceConfig. - A span the runtime never ended is ended when its
Tracecloses and markedagentspec.span.unfinished. - Tracing failures are logged at debug level and never reach your code.
Supported SDK range: pyagentspec >= 26.1.0, < 27 (the first release with the tracing API).