Skip to main content

Respan instrumentation plugin for AgentSpec

Project description

respan-instrumentation-agentspec

Respan instrumentation plugin for AgentSpec (pyagentspec).

This package activates the upstream OpenInference AgentSpec span processor through Respan's OpenInference translator, so AgentSpec spans are exported through the same Respan OTLP pipeline used by Respan.

Installation

pip install respan-ai respan-instrumentation-agentspec "pyagentspec[langgraph]"

Usage

from pyagentspec.adapters.langgraph import AgentSpecLoader
from pyagentspec.agent import Agent
from pyagentspec.llms import OpenAiConfig
from respan import Respan
from respan_instrumentation_agentspec import AgentSpecInstrumentor

respan = Respan(
    app_name="agentspec-haiku-agent",
    instrumentations=[
        AgentSpecInstrumentor(workflow_name="agentspec_haiku_agent")
    ],
)

try:
    agent = Agent(
        name="haiku_assistant",
        description="A helpful assistant that writes haikus.",
        llm_config=OpenAiConfig(name="openai", model_id="gpt-4.1-nano"),
        system_prompt="You are a helpful assistant. Respond only with a haiku.",
    )

    langgraph_agent = AgentSpecLoader().load_component(agent)
    result = langgraph_agent.invoke(
        input={"messages": [{"role": "user", "content": "Write a haiku about tracing."}]}
    )

    print(result["messages"][-1].content)
finally:
    respan.shutdown()
    respan.flush()

Project details


Download files

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

Source Distribution

respan_instrumentation_agentspec-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file respan_instrumentation_agentspec-0.1.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_agentspec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f3e91c3adb89cfdacb2c7c7291411fa2e342a26e35e09d5dd6ead173e44c7c9
MD5 289f0fb2d9f2a1c1f5b7c9ddf375b81f
BLAKE2b-256 8c4ce03f7dee873d455fdf17cce87eec4a39433bc01a549edafe4c76153b0270

See more details on using hashes here.

File details

Details for the file respan_instrumentation_agentspec-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_agentspec-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7bd045c2b07106e6da288528c0db12f3a285d24e58caa6e016f740e82ca93dc6
MD5 015b49ccaca4b3a48ecec83756da22be
BLAKE2b-256 f732e9208423e522c720dd27bcb05ddc1be5e5416b8e3057b6301fce81013526

See more details on using hashes here.

Supported by

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