Skip to main content

AnoSys SDK for OpenAI Agents - Automatic instrumentation and logging for OpenAI Agents

Project description

AnoSys SDK for OpenAI Agents

License: Apache 2.0 Python

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


Download files

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

Source Distribution

anosys_sdk_openai_agents-1.0.9.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

anosys_sdk_openai_agents-1.0.9-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file anosys_sdk_openai_agents-1.0.9.tar.gz.

File metadata

  • Download URL: anosys_sdk_openai_agents-1.0.9.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for anosys_sdk_openai_agents-1.0.9.tar.gz
Algorithm Hash digest
SHA256 4aafa43a06ed796da6f66874a3fb6787f7c50820dcde22242abfc06355e47c32
MD5 78f7f0430f7eccc89dc6824710a5784c
BLAKE2b-256 f14ab3b92deb10148912e1a0387b88383a58eb9e170f1b97b76b34c5c7311ede

See more details on using hashes here.

File details

Details for the file anosys_sdk_openai_agents-1.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for anosys_sdk_openai_agents-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b8f3ac5e9f125ca5251ad3635c8cc08193811877890e1b6cd939ff0550a8f950
MD5 d9e51384012e957d6542efe406cc29cf
BLAKE2b-256 cf4981745d4df0d204b0e90504cd956da7820241e202bd5075512a2d2c03b1b5

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