Skip to main content

OpenInference Agent Spec Instrumentation

Python auto-instrumentation library for Agent Spec.

Open Agent Spec (Agent Spec) is a portable, platform-agnostic configuration language that allows Agents and Agentic Systems to be described with high fidelity. It defines the conceptual building blocks—called components—that make up agents in typical agent-based systems. This includes the properties that configure each component and the semantics that govern their behavior.

Agent Spec Tracing is an extension of Agent Spec that standardizes how agent and flow executions emit traces. It enables:

  • Runtime adapters to emit consistent traces across different frameworks.
  • Consumers (observability backends, UIs, developer tooling) to ingest one standardized format regardless of the producer.

You can find more information about Agent Spec and Agent Spec Tracing at:

The traces emitted by this instrumentation are fully OpenTelemetry compatible and can be sent to an OpenTelemetry collector for viewing, such as Arize Phoenix or Arize AX.

Installation

pip install openinference-instrumentation-agentspec

Quickstart

In this example we will instrument a small program that uses Agent Spec Tracing and observe the traces via arize-phoenix.

Install packages.

pip install openinference-instrumentation-agentspec pyagentspec[langgraph] arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp

Start the phoenix server so that it is ready to collect traces. The Phoenix server runs entirely on your machine and does not send data over the internet.

phoenix serve

In a python file (e.g., agentspec_agent.py) , set up the AgentSpecInstrumentor and configure the tracer to send traces to Phoenix.

from pyagentspec.adapters.langgraph import AgentSpecLoader
from pyagentspec.agent import Agent
from pyagentspec.llms import OpenAiConfig

agent = Agent(
    name="assistant",
    description="An general purpose agent without tools",
    llm_config=OpenAiConfig(name="openai-gpt-5-mini", model_id="gpt-5-mini"),
    system_prompt="You are a helpful assistant. Help the user answering politely.",
)

langgraph_agent = AgentSpecLoader().load_component(agent)

from phoenix.otel import register

from openinference.instrumentation.agentspec import AgentSpecInstrumentor

tracer_provider = register(batch=True, project_name="hello-world-app")
AgentSpecInstrumentor().instrument(tracer_provider=tracer_provider)

while True:
    user_input = input("USER  >>> ")
    if user_input.lower() in ["exit", "quit"]:
        break
    response = langgraph_agent.invoke(
        input={"messages": [{"role": "user", "content": user_input}]},
        config={"configurable": {"thread_id": "1"}},
    )
    print("AGENT >>>", response['messages'][-1].content.strip())

Now simply run the python file and observe the traces in Phoenix.

python agentspec_agent.py

More Info

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file openinference_instrumentation_agentspec-0.1.4.tar.gz.

File metadata

File hashes

Hashes for openinference_instrumentation_agentspec-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2e4bb5bbc31ead7ad783e19c5f9f9e6c84399e61c96a549050b87b1a0f1cac4f
MD5 385708eafe145c934db1bdee7d0d1dc1
BLAKE2b-256 ea404c36a5c0419b3dc6706848072850ff07f80f1526e8b2931be387a9f5d901

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinference_instrumentation_agentspec-0.1.4.tar.gz:

Publisher: publish.yaml on Arize-ai/openinference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openinference_instrumentation_agentspec-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for openinference_instrumentation_agentspec-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5f883ae6ae776fb7552fcb174a7a8e508411dff26eaccb94f77ed1518b52b5f2
MD5 0e479db2c20194ffc8402843fe4ca67d
BLAKE2b-256 c402df23b7be015d75c67680ab56b983514940d4e9fcdfef3c36937071f64649

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinference_instrumentation_agentspec-0.1.4-py3-none-any.whl:

Publisher: publish.yaml on Arize-ai/openinference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.5

2 files

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page