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.1.tar.gz (9.8 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.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for anosys_sdk_openai_agents-1.0.1.tar.gz
Algorithm Hash digest
SHA256 29b364487a4dcd757fb6616c90e7873990520290dd225bc0761286180f4ff778
MD5 00faba60814ad15c0453cd57b5039528
BLAKE2b-256 e836d75e66043fd26e57489983f9355b29c659e620822a776785523722dfa1d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for anosys_sdk_openai_agents-1.0.1.tar.gz:

Publisher: release.yml on Anosys-AI/anosys-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for anosys_sdk_openai_agents-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0b5f6f724797de66db535d35a7b5f24d04ffda5e7be8ad25fececb413e9be26e
MD5 c91b846783aa36a19177700029b6b463
BLAKE2b-256 75c4f491c788fedcf74060d7c1c01a2b3c793073ede2ccfb21e985011c1a9210

See more details on using hashes here.

Provenance

The following attestation bundles were made for anosys_sdk_openai_agents-1.0.1-py3-none-any.whl:

Publisher: release.yml on Anosys-AI/anosys-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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