Metadata-Version: 2.4
Name: agentos-python
Version: 0.1.0
Summary: Python SDK for Agent OS — AI agent observability platform
Project-URL: Homepage, https://agentos.dev
Project-URL: Documentation, https://docs.agentos.dev
Project-URL: Repository, https://github.com/Amitabh1998/agentos-python
Author-email: Agent OS <hello@agentos.dev>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,ai,llm,observability,tracing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.24
Provides-Extra: all
Requires-Dist: anthropic>=0.20; extra == 'all'
Requires-Dist: langchain-core>=0.2; extra == 'all'
Requires-Dist: litellm>=1.0; extra == 'all'
Requires-Dist: openai>=1.0; extra == 'all'
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20; extra == 'all'
Requires-Dist: opentelemetry-sdk>=1.20; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.20; extra == 'anthropic'
Provides-Extra: crewai
Requires-Dist: crewai>=0.50; (python_version >= '3.10') and extra == 'crewai'
Provides-Extra: dev
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.2; extra == 'langchain'
Provides-Extra: litellm
Requires-Dist: litellm>=1.0; extra == 'litellm'
Provides-Extra: llamaindex
Requires-Dist: llama-index-core>=0.10; (python_version >= '3.10') and extra == 'llamaindex'
Provides-Extra: openai
Requires-Dist: openai>=1.0; extra == 'openai'
Provides-Extra: otel
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20; extra == 'otel'
Requires-Dist: opentelemetry-sdk>=1.20; extra == 'otel'
Provides-Extra: pydantic-ai
Requires-Dist: pydantic-ai>=0.1; (python_version >= '3.10') and extra == 'pydantic-ai'
Description-Content-Type: text/markdown

# Agent OS Python SDK

Python SDK for [Agent OS](https://agentos.dev) — AI agent observability, experimentation, and security. "PostHog for AI Agents."

## Install

```bash
pip install agentos
```

## Quick Start

```python
from agentos import wrap_openai
import openai

client = openai.OpenAI()
client = wrap_openai(client, api_key="aos_...", agent_id="my-agent")

# Every LLM call is now automatically traced
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
```

That's it. Open your [Agent OS dashboard](https://app.agentos.dev) to see traces, token usage, costs, and latency.

## Other Ways to Instrument

### `@observe` decorator (Langfuse-compatible)

```python
from agentos import observe

@observe()
def my_agent(query: str) -> str:
    result = search(query)       # auto-traced as child span
    return summarize(result)     # auto-traced as child span

@observe(as_type="generation")
def summarize(text: str) -> str:
    return openai_client.chat.completions.create(...)
```

### Manual event capture

```python
from agentos import AgentOS

client = AgentOS(api_key="aos_...")

client.llm_call("my-agent", model="gpt-4o", system="openai", input_tokens=100, output_tokens=50)
client.tool_call("my-agent", tool_name="web-search", status="success", duration_ms=120)
client.eval("my-agent", eval_name="accuracy", score=0.95)
client.business_event("my-agent", event_name="task_completed")

client.flush()
```

### Environment variable (zero-code)

```bash
export AGENTOS_API_KEY=aos_...
export AGENTOS_ENABLED=true
python my_agent.py
```

## Framework Integrations

| Framework | Integration | One-liner |
|-----------|------------|-----------|
| **OpenAI** | `wrap_openai(client)` | `from agentos import wrap_openai` |
| **Anthropic** | `wrap_anthropic(client)` | `from agentos import wrap_anthropic` |
| **LangChain** | `AgentOSCallbackHandler` | `from agentos.integrations.langchain import AgentOSCallbackHandler` |
| **LlamaIndex** | `AgentOSCallbackHandler` | `from agentos.integrations.llamaindex import AgentOSCallbackHandler` |
| **CrewAI** | `@trace_crew` / `instrument_crewai()` | `from agentos.integrations.crewai import trace_crew` |
| **Pydantic AI** | `wrap_agent()` / `instrument_pydantic_ai()` | `from agentos.integrations.pydantic_ai import wrap_agent` |
| **LiteLLM** | `patch_litellm()` | `from agentos.integrations.litellm import patch_litellm` |
| **OpenTelemetry** | OTLP SpanExporter | `from agentos.compat.otel import register` |

## Migrating From Another Platform?

Change one import and keep your existing code:

| Platform | Migration |
|----------|-----------|
| **Langfuse** | `from agentos.compat.langfuse import Langfuse` |
| **LangSmith** | `from agentos.compat.langsmith import traceable` |
| **Arize Phoenix** | `from agentos.compat.otel import register` (swap endpoint) |
| **Helicone** | `from agentos.compat.helicone import get_proxy_config` |
| **Braintrust** | `from agentos.compat.braintrust import traced, Eval` |
| **W&B Weave** | `from agentos.compat.weave import op` |

## Documentation

Full docs, guides, and API reference: **[docs.agentos.dev](https://docs.agentos.dev)**

## License

MIT
