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.3.tar.gz (9.9 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.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for anosys_sdk_openai_agents-1.0.3.tar.gz
Algorithm Hash digest
SHA256 69fe1e3ee2f7341f5336de61166f9f12115c6b24af6ea1ba8e4d6285095a2b49
MD5 93c82565590020a4075bf72789584048
BLAKE2b-256 18448ad27c86e78c4b6b44553d8da8fb40f6c1587f3f09276fd99be20f104cce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for anosys_sdk_openai_agents-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 25758d60b9d105acd3a9f42d74ea77b8f534a8fc4e5ac1abf5c38e500f47badd
MD5 72dcfa92606cc97727357ac5a45e1144
BLAKE2b-256 f120d64fd41116d903754090ac7a05d728d05c7ea6deecfd97190357d065bd10

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