AnoSys SDK for OpenAI Agents - Automatic instrumentation and logging for OpenAI Agents
Project description
AnoSys SDK for OpenAI Agents
Automatically capture and send OpenAI Agents SDK traces to AnoSys for monitoring, analytics, and observability.
Features
✨ Automatic Agent Tracing - Captures all agent runs, tool calls, and handoffs
✨ TracingProcessor Integration - Native integration with OpenAI Agents SDK
✨ Structured Span Data - Captures agent, function, guardrail, and generation spans
✨ User Context Support - Associate traces with user sessions
Installation
pip install anosys-sdk-openai-agents
Quick Start
import os
from agents import Agent, Runner, set_tracing_processor
from anosys_sdk_openai_agents import AnosysOpenAIAgentsLogger
os.environ["OPENAI_API_KEY"] = "your-openai-key"
os.environ["ANOSYS_API_KEY"] = "your-anosys-key"
# Set up the tracing processor
set_tracing_processor(AnosysOpenAIAgentsLogger())
# Create and run an agent
agent = Agent(
name="Assistant",
instructions="You are a helpful assistant."
)
result = Runner.run_sync(agent, "Hello!")
print(result.final_output)
User Context
Associate traces with user sessions:
def get_user_context():
return {
"session_id": "user-123",
"token": "auth-token"
}
processor = AnosysOpenAIAgentsLogger(get_user_context=get_user_context)
set_tracing_processor(processor)
Span Types Captured
- agent - Agent execution spans
- function - Tool/function calls
- generation - LLM generation calls
- guardrail - Guardrail checks
- handoff - Agent handoffs
- response - Response spans
- custom - Custom spans
Environment Variables
| Variable | Required | Description |
|---|---|---|
ANOSYS_API_KEY |
Yes | Your AnoSys API key |
OPENAI_API_KEY |
Yes | Your OpenAI API key |
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anosys_sdk_openai_agents-1.0.2.tar.gz.
File metadata
- Download URL: anosys_sdk_openai_agents-1.0.2.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54f12dc50e9a3bc1d18b61180ae13cb47c49e87ae063696d9711d14bfaea99ae
|
|
| MD5 |
04fef35232d714954c512779a501be9d
|
|
| BLAKE2b-256 |
7afcdb04404fc705f0db435d3df90ebe51a8bf06d92419bea93f19dfb43a8c46
|
File details
Details for the file anosys_sdk_openai_agents-1.0.2-py3-none-any.whl.
File metadata
- Download URL: anosys_sdk_openai_agents-1.0.2-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bd9caef60cbda221daa31eec7b40bc300236e119366c5111b03e26e8023b42a
|
|
| MD5 |
50ada7c76bf89eeb277d7a18aabe02df
|
|
| BLAKE2b-256 |
f513e7145ea55f1f9b93f4f7d179cd19cd12a8c6a6a34db2af2b2436331d3dcb
|