agentos-python 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentos_python-0.1.0/.github/workflows/ci.yml +40 -0
- agentos_python-0.1.0/.github/workflows/publish.yml +55 -0
- agentos_python-0.1.0/CHANGELOG.md +18 -0
- agentos_python-0.1.0/LICENSE +21 -0
- agentos_python-0.1.0/PKG-INFO +155 -0
- agentos_python-0.1.0/README.md +101 -0
- agentos_python-0.1.0/pyproject.toml +68 -0
- agentos_python-0.1.0/src/agentos/__init__.py +58 -0
- agentos_python-0.1.0/src/agentos/client.py +273 -0
- agentos_python-0.1.0/src/agentos/compat/__init__.py +4 -0
- agentos_python-0.1.0/src/agentos/compat/braintrust.py +97 -0
- agentos_python-0.1.0/src/agentos/compat/helicone.py +72 -0
- agentos_python-0.1.0/src/agentos/compat/langfuse.py +317 -0
- agentos_python-0.1.0/src/agentos/compat/langsmith.py +79 -0
- agentos_python-0.1.0/src/agentos/compat/otel.py +167 -0
- agentos_python-0.1.0/src/agentos/compat/weave.py +93 -0
- agentos_python-0.1.0/src/agentos/config.py +34 -0
- agentos_python-0.1.0/src/agentos/decorators.py +372 -0
- agentos_python-0.1.0/src/agentos/events.py +449 -0
- agentos_python-0.1.0/src/agentos/integrations/__init__.py +15 -0
- agentos_python-0.1.0/src/agentos/integrations/anthropic.py +130 -0
- agentos_python-0.1.0/src/agentos/integrations/crewai.py +221 -0
- agentos_python-0.1.0/src/agentos/integrations/langchain.py +307 -0
- agentos_python-0.1.0/src/agentos/integrations/litellm.py +123 -0
- agentos_python-0.1.0/src/agentos/integrations/llamaindex.py +174 -0
- agentos_python-0.1.0/src/agentos/integrations/openai.py +149 -0
- agentos_python-0.1.0/src/agentos/integrations/pydantic_ai.py +236 -0
- agentos_python-0.1.0/src/agentos/py.typed +0 -0
- agentos_python-0.1.0/src/agentos/tracing.py +168 -0
- agentos_python-0.1.0/src/agentos/transport.py +285 -0
- agentos_python-0.1.0/src/agentos/types.py +101 -0
- agentos_python-0.1.0/tests/__init__.py +0 -0
- agentos_python-0.1.0/tests/test_client.py +240 -0
- agentos_python-0.1.0/tests/test_compat/__init__.py +0 -0
- agentos_python-0.1.0/tests/test_compat/test_helicone.py +36 -0
- agentos_python-0.1.0/tests/test_compat/test_langfuse.py +135 -0
- agentos_python-0.1.0/tests/test_compat/test_langsmith.py +34 -0
- agentos_python-0.1.0/tests/test_decorators.py +202 -0
- agentos_python-0.1.0/tests/test_events.py +231 -0
- agentos_python-0.1.0/tests/test_integrations/__init__.py +0 -0
- agentos_python-0.1.0/tests/test_integrations/test_crewai.py +104 -0
- agentos_python-0.1.0/tests/test_integrations/test_langchain.py +134 -0
- agentos_python-0.1.0/tests/test_integrations/test_llamaindex.py +92 -0
- agentos_python-0.1.0/tests/test_integrations/test_openai.py +210 -0
- agentos_python-0.1.0/tests/test_tracing.py +121 -0
- agentos_python-0.1.0/tests/test_transport.py +204 -0
- agentos_python-0.1.0/tests/test_types.py +125 -0
- agentos_python-0.1.0/uv.lock +6199 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
run: uv python install ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: uv sync && uv pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Lint
|
|
30
|
+
run: uv run ruff check .
|
|
31
|
+
|
|
32
|
+
- name: Format check
|
|
33
|
+
run: uv run ruff format --check .
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: uv run pytest -v --ignore=tests/test_client.py --ignore=tests/test_decorators.py
|
|
37
|
+
|
|
38
|
+
- name: Run client tests
|
|
39
|
+
run: uv run pytest tests/test_client.py tests/test_decorators.py -v
|
|
40
|
+
timeout-minutes: 5
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.10", "3.12"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
run: uv python install ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: uv sync && uv pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Lint
|
|
30
|
+
run: uv run ruff check .
|
|
31
|
+
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: uv run pytest -v
|
|
34
|
+
|
|
35
|
+
publish:
|
|
36
|
+
needs: test
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment: pypi
|
|
39
|
+
permissions:
|
|
40
|
+
contents: read
|
|
41
|
+
id-token: write
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
|
|
45
|
+
- name: Install uv
|
|
46
|
+
uses: astral-sh/setup-uv@v4
|
|
47
|
+
|
|
48
|
+
- name: Set up Python
|
|
49
|
+
run: uv python install 3.12
|
|
50
|
+
|
|
51
|
+
- name: Build package
|
|
52
|
+
run: uv build
|
|
53
|
+
|
|
54
|
+
- name: Publish to PyPI
|
|
55
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-04-05)
|
|
4
|
+
|
|
5
|
+
Initial release.
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- **Core client** — `AgentOS` (sync) and `AsyncAgentOS` (async) with batched delivery, retry, and graceful shutdown
|
|
10
|
+
- **Event builders** — typed helpers for all 8 event types: `llm_call`, `tool_call`, `handoff`, `retrieval_query`, `eval`, `security_alert`, `flag_check`, `business_event`
|
|
11
|
+
- **Tracing** — `trace()` and `span()` context managers with automatic context propagation via `contextvars`
|
|
12
|
+
- **Decorators** — `@observe()` (Langfuse-compatible), `@trace_agent`, `@trace_tool`
|
|
13
|
+
- **`wrap_openai()`** — one-liner auto-instrumentation for OpenAI SDK
|
|
14
|
+
- **`wrap_anthropic()`** — one-liner auto-instrumentation for Anthropic SDK
|
|
15
|
+
- **Framework integrations** — LangChain `CallbackHandler`, CrewAI `@trace_crew`/`@trace_task`, Pydantic AI `wrap_agent`, LlamaIndex `CallbackHandler`, LiteLLM `patch_litellm`
|
|
16
|
+
- **Migration compat layers** — drop-in shims for Langfuse, LangSmith, Arize Phoenix (OTLP), Helicone, Braintrust, W&B Weave
|
|
17
|
+
- **Privacy mode** — `capture_content=False` strips message content
|
|
18
|
+
- **Env-var auto-init** — set `AGENTOS_API_KEY` for zero-code activation
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agent OS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentos-python
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for Agent OS — AI agent observability platform
|
|
5
|
+
Project-URL: Homepage, https://agentos.dev
|
|
6
|
+
Project-URL: Documentation, https://docs.agentos.dev
|
|
7
|
+
Project-URL: Repository, https://github.com/Amitabh1998/agentos-python
|
|
8
|
+
Author-email: Agent OS <hello@agentos.dev>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,ai,llm,observability,tracing
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: httpx<1,>=0.24
|
|
23
|
+
Provides-Extra: all
|
|
24
|
+
Requires-Dist: anthropic>=0.20; extra == 'all'
|
|
25
|
+
Requires-Dist: langchain-core>=0.2; extra == 'all'
|
|
26
|
+
Requires-Dist: litellm>=1.0; extra == 'all'
|
|
27
|
+
Requires-Dist: openai>=1.0; extra == 'all'
|
|
28
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20; extra == 'all'
|
|
29
|
+
Requires-Dist: opentelemetry-sdk>=1.20; extra == 'all'
|
|
30
|
+
Provides-Extra: anthropic
|
|
31
|
+
Requires-Dist: anthropic>=0.20; extra == 'anthropic'
|
|
32
|
+
Provides-Extra: crewai
|
|
33
|
+
Requires-Dist: crewai>=0.50; (python_version >= '3.10') and extra == 'crewai'
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: mypy>=1.11; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
38
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
39
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
40
|
+
Provides-Extra: langchain
|
|
41
|
+
Requires-Dist: langchain-core>=0.2; extra == 'langchain'
|
|
42
|
+
Provides-Extra: litellm
|
|
43
|
+
Requires-Dist: litellm>=1.0; extra == 'litellm'
|
|
44
|
+
Provides-Extra: llamaindex
|
|
45
|
+
Requires-Dist: llama-index-core>=0.10; (python_version >= '3.10') and extra == 'llamaindex'
|
|
46
|
+
Provides-Extra: openai
|
|
47
|
+
Requires-Dist: openai>=1.0; extra == 'openai'
|
|
48
|
+
Provides-Extra: otel
|
|
49
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20; extra == 'otel'
|
|
50
|
+
Requires-Dist: opentelemetry-sdk>=1.20; extra == 'otel'
|
|
51
|
+
Provides-Extra: pydantic-ai
|
|
52
|
+
Requires-Dist: pydantic-ai>=0.1; (python_version >= '3.10') and extra == 'pydantic-ai'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
# Agent OS Python SDK
|
|
56
|
+
|
|
57
|
+
Python SDK for [Agent OS](https://agentos.dev) — AI agent observability, experimentation, and security. "PostHog for AI Agents."
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install agentos
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from agentos import wrap_openai
|
|
69
|
+
import openai
|
|
70
|
+
|
|
71
|
+
client = openai.OpenAI()
|
|
72
|
+
client = wrap_openai(client, api_key="aos_...", agent_id="my-agent")
|
|
73
|
+
|
|
74
|
+
# Every LLM call is now automatically traced
|
|
75
|
+
response = client.chat.completions.create(
|
|
76
|
+
model="gpt-4o",
|
|
77
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
That's it. Open your [Agent OS dashboard](https://app.agentos.dev) to see traces, token usage, costs, and latency.
|
|
82
|
+
|
|
83
|
+
## Other Ways to Instrument
|
|
84
|
+
|
|
85
|
+
### `@observe` decorator (Langfuse-compatible)
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from agentos import observe
|
|
89
|
+
|
|
90
|
+
@observe()
|
|
91
|
+
def my_agent(query: str) -> str:
|
|
92
|
+
result = search(query) # auto-traced as child span
|
|
93
|
+
return summarize(result) # auto-traced as child span
|
|
94
|
+
|
|
95
|
+
@observe(as_type="generation")
|
|
96
|
+
def summarize(text: str) -> str:
|
|
97
|
+
return openai_client.chat.completions.create(...)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Manual event capture
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from agentos import AgentOS
|
|
104
|
+
|
|
105
|
+
client = AgentOS(api_key="aos_...")
|
|
106
|
+
|
|
107
|
+
client.llm_call("my-agent", model="gpt-4o", system="openai", input_tokens=100, output_tokens=50)
|
|
108
|
+
client.tool_call("my-agent", tool_name="web-search", status="success", duration_ms=120)
|
|
109
|
+
client.eval("my-agent", eval_name="accuracy", score=0.95)
|
|
110
|
+
client.business_event("my-agent", event_name="task_completed")
|
|
111
|
+
|
|
112
|
+
client.flush()
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Environment variable (zero-code)
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
export AGENTOS_API_KEY=aos_...
|
|
119
|
+
export AGENTOS_ENABLED=true
|
|
120
|
+
python my_agent.py
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Framework Integrations
|
|
124
|
+
|
|
125
|
+
| Framework | Integration | One-liner |
|
|
126
|
+
|-----------|------------|-----------|
|
|
127
|
+
| **OpenAI** | `wrap_openai(client)` | `from agentos import wrap_openai` |
|
|
128
|
+
| **Anthropic** | `wrap_anthropic(client)` | `from agentos import wrap_anthropic` |
|
|
129
|
+
| **LangChain** | `AgentOSCallbackHandler` | `from agentos.integrations.langchain import AgentOSCallbackHandler` |
|
|
130
|
+
| **LlamaIndex** | `AgentOSCallbackHandler` | `from agentos.integrations.llamaindex import AgentOSCallbackHandler` |
|
|
131
|
+
| **CrewAI** | `@trace_crew` / `instrument_crewai()` | `from agentos.integrations.crewai import trace_crew` |
|
|
132
|
+
| **Pydantic AI** | `wrap_agent()` / `instrument_pydantic_ai()` | `from agentos.integrations.pydantic_ai import wrap_agent` |
|
|
133
|
+
| **LiteLLM** | `patch_litellm()` | `from agentos.integrations.litellm import patch_litellm` |
|
|
134
|
+
| **OpenTelemetry** | OTLP SpanExporter | `from agentos.compat.otel import register` |
|
|
135
|
+
|
|
136
|
+
## Migrating From Another Platform?
|
|
137
|
+
|
|
138
|
+
Change one import and keep your existing code:
|
|
139
|
+
|
|
140
|
+
| Platform | Migration |
|
|
141
|
+
|----------|-----------|
|
|
142
|
+
| **Langfuse** | `from agentos.compat.langfuse import Langfuse` |
|
|
143
|
+
| **LangSmith** | `from agentos.compat.langsmith import traceable` |
|
|
144
|
+
| **Arize Phoenix** | `from agentos.compat.otel import register` (swap endpoint) |
|
|
145
|
+
| **Helicone** | `from agentos.compat.helicone import get_proxy_config` |
|
|
146
|
+
| **Braintrust** | `from agentos.compat.braintrust import traced, Eval` |
|
|
147
|
+
| **W&B Weave** | `from agentos.compat.weave import op` |
|
|
148
|
+
|
|
149
|
+
## Documentation
|
|
150
|
+
|
|
151
|
+
Full docs, guides, and API reference: **[docs.agentos.dev](https://docs.agentos.dev)**
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
MIT
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Agent OS Python SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for [Agent OS](https://agentos.dev) — AI agent observability, experimentation, and security. "PostHog for AI Agents."
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install agentos
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from agentos import wrap_openai
|
|
15
|
+
import openai
|
|
16
|
+
|
|
17
|
+
client = openai.OpenAI()
|
|
18
|
+
client = wrap_openai(client, api_key="aos_...", agent_id="my-agent")
|
|
19
|
+
|
|
20
|
+
# Every LLM call is now automatically traced
|
|
21
|
+
response = client.chat.completions.create(
|
|
22
|
+
model="gpt-4o",
|
|
23
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
That's it. Open your [Agent OS dashboard](https://app.agentos.dev) to see traces, token usage, costs, and latency.
|
|
28
|
+
|
|
29
|
+
## Other Ways to Instrument
|
|
30
|
+
|
|
31
|
+
### `@observe` decorator (Langfuse-compatible)
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from agentos import observe
|
|
35
|
+
|
|
36
|
+
@observe()
|
|
37
|
+
def my_agent(query: str) -> str:
|
|
38
|
+
result = search(query) # auto-traced as child span
|
|
39
|
+
return summarize(result) # auto-traced as child span
|
|
40
|
+
|
|
41
|
+
@observe(as_type="generation")
|
|
42
|
+
def summarize(text: str) -> str:
|
|
43
|
+
return openai_client.chat.completions.create(...)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Manual event capture
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from agentos import AgentOS
|
|
50
|
+
|
|
51
|
+
client = AgentOS(api_key="aos_...")
|
|
52
|
+
|
|
53
|
+
client.llm_call("my-agent", model="gpt-4o", system="openai", input_tokens=100, output_tokens=50)
|
|
54
|
+
client.tool_call("my-agent", tool_name="web-search", status="success", duration_ms=120)
|
|
55
|
+
client.eval("my-agent", eval_name="accuracy", score=0.95)
|
|
56
|
+
client.business_event("my-agent", event_name="task_completed")
|
|
57
|
+
|
|
58
|
+
client.flush()
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Environment variable (zero-code)
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
export AGENTOS_API_KEY=aos_...
|
|
65
|
+
export AGENTOS_ENABLED=true
|
|
66
|
+
python my_agent.py
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Framework Integrations
|
|
70
|
+
|
|
71
|
+
| Framework | Integration | One-liner |
|
|
72
|
+
|-----------|------------|-----------|
|
|
73
|
+
| **OpenAI** | `wrap_openai(client)` | `from agentos import wrap_openai` |
|
|
74
|
+
| **Anthropic** | `wrap_anthropic(client)` | `from agentos import wrap_anthropic` |
|
|
75
|
+
| **LangChain** | `AgentOSCallbackHandler` | `from agentos.integrations.langchain import AgentOSCallbackHandler` |
|
|
76
|
+
| **LlamaIndex** | `AgentOSCallbackHandler` | `from agentos.integrations.llamaindex import AgentOSCallbackHandler` |
|
|
77
|
+
| **CrewAI** | `@trace_crew` / `instrument_crewai()` | `from agentos.integrations.crewai import trace_crew` |
|
|
78
|
+
| **Pydantic AI** | `wrap_agent()` / `instrument_pydantic_ai()` | `from agentos.integrations.pydantic_ai import wrap_agent` |
|
|
79
|
+
| **LiteLLM** | `patch_litellm()` | `from agentos.integrations.litellm import patch_litellm` |
|
|
80
|
+
| **OpenTelemetry** | OTLP SpanExporter | `from agentos.compat.otel import register` |
|
|
81
|
+
|
|
82
|
+
## Migrating From Another Platform?
|
|
83
|
+
|
|
84
|
+
Change one import and keep your existing code:
|
|
85
|
+
|
|
86
|
+
| Platform | Migration |
|
|
87
|
+
|----------|-----------|
|
|
88
|
+
| **Langfuse** | `from agentos.compat.langfuse import Langfuse` |
|
|
89
|
+
| **LangSmith** | `from agentos.compat.langsmith import traceable` |
|
|
90
|
+
| **Arize Phoenix** | `from agentos.compat.otel import register` (swap endpoint) |
|
|
91
|
+
| **Helicone** | `from agentos.compat.helicone import get_proxy_config` |
|
|
92
|
+
| **Braintrust** | `from agentos.compat.braintrust import traced, Eval` |
|
|
93
|
+
| **W&B Weave** | `from agentos.compat.weave import op` |
|
|
94
|
+
|
|
95
|
+
## Documentation
|
|
96
|
+
|
|
97
|
+
Full docs, guides, and API reference: **[docs.agentos.dev](https://docs.agentos.dev)**
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "agentos-python"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for Agent OS — AI agent observability platform"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [{ name = "Agent OS", email = "hello@agentos.dev" }]
|
|
13
|
+
keywords = ["ai", "agents", "observability", "tracing", "llm"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Topic :: Software Development :: Libraries",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
dependencies = ["httpx>=0.24,<1"]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
openai = ["openai>=1.0"]
|
|
29
|
+
anthropic = ["anthropic>=0.20"]
|
|
30
|
+
litellm = ["litellm>=1.0"]
|
|
31
|
+
langchain = ["langchain-core>=0.2"]
|
|
32
|
+
crewai = ["crewai>=0.50; python_version>='3.10'"]
|
|
33
|
+
pydantic-ai = ["pydantic-ai>=0.1; python_version>='3.10'"]
|
|
34
|
+
llamaindex = ["llama-index-core>=0.10; python_version>='3.10'"]
|
|
35
|
+
otel = ["opentelemetry-sdk>=1.20", "opentelemetry-exporter-otlp-proto-http>=1.20"]
|
|
36
|
+
all = ["agentos-python[openai,anthropic,litellm,langchain,otel]"]
|
|
37
|
+
dev = [
|
|
38
|
+
"pytest>=8",
|
|
39
|
+
"pytest-asyncio>=0.23",
|
|
40
|
+
"respx>=0.21",
|
|
41
|
+
"mypy>=1.11",
|
|
42
|
+
"ruff>=0.6",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.urls]
|
|
46
|
+
Homepage = "https://agentos.dev"
|
|
47
|
+
Documentation = "https://docs.agentos.dev"
|
|
48
|
+
Repository = "https://github.com/Amitabh1998/agentos-python"
|
|
49
|
+
|
|
50
|
+
[tool.hatch.build.targets.wheel]
|
|
51
|
+
packages = ["src/agentos"]
|
|
52
|
+
|
|
53
|
+
[tool.ruff]
|
|
54
|
+
target-version = "py310"
|
|
55
|
+
line-length = 100
|
|
56
|
+
|
|
57
|
+
[tool.ruff.lint]
|
|
58
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
59
|
+
|
|
60
|
+
[tool.mypy]
|
|
61
|
+
python_version = "3.10"
|
|
62
|
+
strict = true
|
|
63
|
+
warn_return_any = true
|
|
64
|
+
warn_unused_configs = true
|
|
65
|
+
|
|
66
|
+
[tool.pytest.ini_options]
|
|
67
|
+
asyncio_mode = "auto"
|
|
68
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Agent OS Python SDK — AI agent observability platform.
|
|
2
|
+
|
|
3
|
+
Usage::
|
|
4
|
+
|
|
5
|
+
from agentos import AgentOS
|
|
6
|
+
|
|
7
|
+
client = AgentOS(api_key="aos_...")
|
|
8
|
+
client.llm_call("my-agent", model="gpt-4o", system="openai")
|
|
9
|
+
client.flush()
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from agentos.client import AgentOS, AsyncAgentOS, get_client
|
|
13
|
+
from agentos.config import AgentOSConfig
|
|
14
|
+
from agentos.decorators import observe, trace_agent, trace_context, trace_tool
|
|
15
|
+
from agentos.integrations.anthropic import wrap_anthropic
|
|
16
|
+
from agentos.integrations.openai import wrap_openai
|
|
17
|
+
from agentos.tracing import TraceContext, span, trace
|
|
18
|
+
from agentos.types import (
|
|
19
|
+
ErrorInfo,
|
|
20
|
+
EvalEvaluator,
|
|
21
|
+
EventPayload,
|
|
22
|
+
EventType,
|
|
23
|
+
FinishReason,
|
|
24
|
+
LLMMessage,
|
|
25
|
+
SecurityAction,
|
|
26
|
+
SecurityAlertType,
|
|
27
|
+
Severity,
|
|
28
|
+
ToolStatus,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
__version__ = "0.1.0"
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"__version__",
|
|
35
|
+
"AgentOS",
|
|
36
|
+
"AgentOSConfig",
|
|
37
|
+
"AsyncAgentOS",
|
|
38
|
+
"ErrorInfo",
|
|
39
|
+
"EvalEvaluator",
|
|
40
|
+
"EventPayload",
|
|
41
|
+
"EventType",
|
|
42
|
+
"FinishReason",
|
|
43
|
+
"LLMMessage",
|
|
44
|
+
"SecurityAction",
|
|
45
|
+
"SecurityAlertType",
|
|
46
|
+
"Severity",
|
|
47
|
+
"ToolStatus",
|
|
48
|
+
"TraceContext",
|
|
49
|
+
"get_client",
|
|
50
|
+
"observe",
|
|
51
|
+
"span",
|
|
52
|
+
"trace",
|
|
53
|
+
"trace_agent",
|
|
54
|
+
"trace_context",
|
|
55
|
+
"trace_tool",
|
|
56
|
+
"wrap_anthropic",
|
|
57
|
+
"wrap_openai",
|
|
58
|
+
]
|