Metadata-Version: 2.4
Name: agent-ops-otel-sdk
Version: 0.1.0
Summary: Thin OpenTelemetry SDK for Agent Ops
Author: Agent Ops Contributors
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/DraskyChen/Agent-Ops#readme
Project-URL: Repository, https://github.com/DraskyChen/Agent-Ops
Project-URL: Issues, https://github.com/DraskyChen/Agent-Ops/issues
Keywords: agent,observability,opentelemetry,tracing,llm
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: opentelemetry-api<2,>=1.38
Requires-Dist: opentelemetry-sdk<2,>=1.38
Requires-Dist: opentelemetry-exporter-otlp-proto-http<2,>=1.38
Requires-Dist: requests<3,>=2.32
Provides-Extra: dev
Requires-Dist: mypy>=1.15; extra == "dev"
Requires-Dist: pytest>=8.3; extra == "dev"
Requires-Dist: ruff>=0.11; extra == "dev"
Dynamic: license-file

# Agent Ops Python SDK

OpenTelemetry tracing helpers for Python agents that send traces to Agent Ops.

## Requirements

- Python 3.11 or newer
- An Agent Ops OTLP endpoint and ingest token

## Install

```bash
pip install agent-ops-otel-sdk
```

## Quick start

```python
import os

from agent_ops import (
    Environment,
    TracingConfig,
    agent_run,
    configure_tracing,
    llm_call,
    shutdown_tracing,
    tool_call,
)

configure_tracing(
    TracingConfig(
        service_name="support-agent",
        service_version="1.4.0",
        app_name="customer-support",
        environment=Environment.PROD,
        endpoint="https://agent-ops.example.com/v1/traces",
        headers={
            "authorization": f"Bearer {os.environ['AGENT_OPS_INGEST_TOKEN']}"
        },
    )
)

try:
    with agent_run(
        session_id="session-123",
        task_type="support",
        input_summary="Resolve a duplicate subscription",
    ) as run:
        with llm_call(
            provider="deepseek",
            request_model="deepseek-flash",
            input_tokens=420,
            output_tokens=80,
        ):
            pass

        with tool_call(
            name="cancel_subscription",
            args_summary='{"subscriptionId":"sub-b"}',
        ):
            pass

        run.complete("success", "final_answer")
finally:
    shutdown_tracing()
```

To capture complete input and output content, set `content_capture=True` and
provide `content_token`. Captured content is redacted and uploaded through the
Agent Ops server before its content ID is attached to the span.

The package exposes `__version__`, contract constants such as `Attr`, and
helpers for `agent.run`, `llm.call`, `tool.call`, `retrieval`, and `sub_agent`
spans.

## License

Apache-2.0. See [LICENSE](LICENSE).
