Official SDKs for integrating with AnoSys — AI observability, monitoring, and analytics platform.
Add a few lines of code and every LLM call, agent run, and Claude Code session is automatically captured and sent to your AnoSys workspace.
| Package | Version | Description | Install |
|---|---|---|---|
anosys-sdk-core |
1.0.13 | Shared core — config, HTTP client, decorators, data models | pip install anosys-sdk-core |
anosys-sdk-openai |
1.0.13 | OpenAI SDK instrumentation via OpenTelemetry | pip install anosys-sdk-openai |
anosys-sdk-openai-agents |
1.0.12 | OpenAI Agents SDK tracing (TracingProcessor) | pip install anosys-sdk-openai-agents |
anosys-claude-code |
0.2.8 | Claude Code observability hook & CLI | pip install anosys-claude-code |
| Package | Version | Description | Install |
|---|---|---|---|
anosys-sdk-openai |
1.0.11 | OpenAI SDK instrumentation via OpenTelemetry | npm install anosys-sdk-openai |
anosys-sdk-openai-agents |
1.0.11 | OpenAI Agents SDK tracing (addTracingProcessor) |
npm install anosys-sdk-openai-agents |
anosys-sdk-claude-code |
0.2.5 | Claude Code observability hook & CLI | npx anosys-sdk-claude-code install |
- Sign up at anosys.ai and obtain your AnoSys API Key from the integration options page.
- Copy
.env.exampleto.envand fill in your keys:
cp .env.example .env# Required
ANOSYS_API_KEY=your_anosys_api_key_here
# Required for OpenAI integrations
OPENAI_API_KEY=your_openai_api_key_here
# Optional overrides
# ANOSYS_API_URL=https://www.anosys.ai
# ANOSYS_RESOLVER_URL=https://console.anosys.ai/api/resolveapikeysimport os
from openai import OpenAI
from anosys_sdk_openai import AnosysOpenAILogger
os.environ["OPENAI_API_KEY"] = "your-openai-key"
os.environ["ANOSYS_API_KEY"] = "your-anosys-key"
# Initialize once at startup — all subsequent calls are logged automatically
AnosysOpenAILogger()
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)import { AnosysOpenAILogger } from 'anosys-sdk-openai';
import OpenAI from 'openai';
// Initialize once — instruments all subsequent OpenAI calls automatically
new AnosysOpenAILogger();
const client = new OpenAI();
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }],
});from agents import Agent, Runner, set_tracing_processor
from anosys_sdk_openai_agents import AnosysOpenAIAgentsLogger
set_tracing_processor(AnosysOpenAIAgentsLogger())
agent = Agent(name="Assistant", instructions="You are helpful.")
result = Runner.run_sync(agent, "Hello!")
print(result.final_output)import { AnosysOpenAIAgentsLogger } from 'anosys-sdk-openai-agents';
import { Agent, run, addTracingProcessor } from '@openai/agents';
const logger = new AnosysOpenAIAgentsLogger();
addTracingProcessor(logger);
const agent = new Agent({ name: 'my-agent', instructions: 'You are helpful.' });
const result = await run(agent, 'Hello');Install the package and run the setup wizard:
pip install anosys-claude-code
anosys-claude-code installOr install headlessly:
anosys-claude-code install \
--api-key "your_logs_api_key" \
--otel-key "your_otel_api_key" \
--redactionCLI commands: install · uninstall · status · run
npx anosys-sdk-claude-code installOr install headlessly:
npx anosys-sdk-claude-code install \
--api-key "your_logs_api_key" \
--otel-key "your_otel_api_key" \
--redactionCLI commands: install · uninstall · status · run
How it works: When installed, both Python and JS packages register a Stop hook in ~/.claude/settings.json. When a Claude Code session ends, the hook scans local transcripts (~/.claude/projects/), incrementally maps new messages and subagent events, calculates pricing, applies optional content redaction, and batches results to your AnoSys workspace.
Use the core decorator to log any function — works with both sync and async:
from anosys_sdk_core import anosys_logger, anosys_raw_logger
@anosys_logger(source="my_app")
def my_function(data):
return process(data)
@anosys_logger(source="my_app.async")
async def my_async_function(data):
return await async_process(data)
# Log arbitrary data directly
anosys_raw_logger({"event": "custom_event", "data": {"key": "value"}})import { anosysLogger, anosysRawLogger } from 'anosys-sdk-openai';
const myFunction = anosysLogger('my_app.pipeline')(async (input) => {
// your logic
return result;
});
// Log arbitrary data directly
await anosysRawLogger({ event: 'user_action', user_id: 'u123', value: 42 });Associate traces with user sessions for richer analytics:
from anosys_sdk_openai_agents import AnosysOpenAIAgentsLogger
def get_user_context():
return {"session_id": "user-123", "token": "auth-token"}
processor = AnosysOpenAIAgentsLogger(get_user_context=get_user_context)new AnosysOpenAILogger({
getUserContext: () => ({ session_id: req.sessionId, token: req.token }),
});anosys-sdk/
├── packages/
│ ├── python/
│ │ ├── core/ # anosys-sdk-core
│ │ ├── openai/ # anosys-sdk-openai
│ │ ├── openai_agents/ # anosys-sdk-openai-agents
│ │ └── claude_code/ # anosys-claude-code
│ └── js/
│ ├── openai/ # anosys-sdk-openai (npm)
│ ├── openai-agents/ # anosys-sdk-openai-agents (npm)
│ └── claude-code/ # anosys-sdk-claude-code (npm)
├── examples/ # Jupyter notebook demos
├── scripts/
│ └── release.sh # Per-package release script
├── MAPPINGS.md # CVS variable mapping reference
├── Makefile # Build, test, lint shortcuts
└── .github/workflows/
├── ci.yml # CI: Python 3.10–3.12, Node 18/20/22
├── release-python.yml # Auto-publish Python packages to PyPI
├── release-js.yml # Auto-publish JS packages to npm
└── claudecode-install-test.yml
| Variable | Required | Description |
|---|---|---|
ANOSYS_API_KEY |
Yes | Your AnoSys API key (get one here) |
OPENAI_API_KEY |
Yes* | Required for OpenAI / OpenAI Agents packages |
ANOSYS_API_URL |
No | Override the logging endpoint (default: https://www.anosys.ai) |
ANOSYS_RESOLVER_URL |
No | Override the API key resolver endpoint |
ANOSYS_LOG_LEVEL |
No | JS only: debug / info / warn / error / silent (default: warn) |
# Install all Python packages in editable mode + JS workspaces
make install
# Install with dev dependencies (pytest, ruff, etc.)
make install-dev# Run all tests (Python + JS)
make test
# Python only
make test-py
# JavaScript only
make test-jsCI runs on every push/PR to main across Python 3.10 / 3.11 / 3.12 and Node.js 18 / 20 / 22.
# Lint Python with Ruff
make lint
# Auto-format Python
make format-py# Build all Python packages
make build-py
# Build all JS packages
make build-js
# Remove all build artifacts
make cleanReleases are per-package using the included release script:
scripts/release.sh <component> <version>Components:
| Component | Package | Registry |
|---|---|---|
core |
anosys-sdk-core |
PyPI |
openai-py |
anosys-sdk-openai |
PyPI |
openai-agents-py |
anosys-sdk-openai-agents |
PyPI |
claude-code |
anosys-claude-code |
PyPI |
openai-js |
anosys-sdk-openai |
npm |
openai-agents-js |
anosys-sdk-openai-agents |
npm |
claude-code-js |
anosys-sdk-claude-code |
npm |
The script bumps the version, commits, tags as <component>-v<version>, and pushes. The corresponding GitHub Actions workflow builds and publishes the package automatically.
Example:
scripts/release.sh openai-js 1.0.12The examples/ directory contains Jupyter notebooks demonstrating end-to-end integrations:
anosys_openai_chat_poc.ipynb— Basic OpenAI chat completions logginganosys_openai_agentic_poc.ipynb— Multi-agent workflow with full trace captureanosys_openai_support_copilot_demo.ipynb— Advanced single-agent demo: a realistic e-commerce support copilot that auto-runs healthy → failure-injected → fix-verified phases (silent unit regression in a backend tool, no flags to edit), root-caused from AnoSys trace data, incl. a ready-made AnoSys AI root-causing promptanosys_openai_research_pipeline_demo.ipynb— Advanced multi-agent demo: an investment-research pipeline (handoffs + shared workspace) that auto-runs healthy → failure-injected → fix-verified phases (silent context-truncation failure, no flags to edit), root-caused from AnoSys trace data, incl. a ready-made AnoSys AI root-causing prompt
- SDK Docs: docs.anosys.ai
- AnoSys Console: console.anosys.ai
- CVS Variable Mappings: MAPPINGS.md — full reference for how SDK fields map to AnoSys platform variables
Apache 2.0 — see LICENSE.