Skip to main content

One-line instrumentation for agent building SDKs

Project description

๐Ÿ” Chaukas SDK

One line to instrument your agent and capture every event in an immutable, queryable audit trail.

Open-source SDK implementing chaukas-spec for standardized agent instrumentation

PyPI version Python 3.9+ License: Apache 2.0 Tests Coverage

Quick Start โ€ข Documentation โ€ข Examples โ€ข chaukas-spec โ€ข Community


๐ŸŽฏ Why Chaukas?

Building AI agents is hard. Understanding what they're doing is harder.

Chaukas SDK is an open-source SDK that implements the chaukas-spec โ€” a standardized event schema for AI agent instrumentation. It gives you X-ray vision into your AI agents with zero configuration:

import chaukas
chaukas.enable_chaukas()  # That's it. You're done.

# Your existing agent code works unchanged
agent = Agent(name="assistant", model="gpt-4")
result = await agent.run(messages=[...])

Instantly get:

  • ๐ŸŽฏ Complete execution traces with distributed tracing
  • ๐Ÿ”„ Automatic retry detection and tracking
  • ๐Ÿ› ๏ธ Tool call monitoring and performance metrics
  • ๐Ÿค Multi-agent handoff visualization
  • ๐Ÿšจ Error tracking with full context
  • ๐Ÿ“Š LLM token usage and cost tracking
  • ๐Ÿ” Policy enforcement and compliance logs
  • ๐ŸŽจ Beautiful, queryable event streams

โœจ What Makes Chaukas Different

Feature Chaukas Traditional APM Manual Logging
Setup Time 1 line Hours Days
Code Changes Zero Extensive Everywhere
Agent-Native โœ… 100% โŒ Adapted โŒ Custom
Event Coverage ๐ŸŽ‰ 19/19 chaukas-spec โš ๏ธ Partial ๐Ÿคท Up to you
Standardized Schema โœ… chaukas-spec โŒ Proprietary โŒ None
Multi-Agent Tracking โœ… Built-in โŒ Manual โŒ Complex
MCP Protocol โœ… Native โŒ No support โŒ Manual
Distributed Tracing โœ… Automatic โš ๏ธ Requires setup โŒ Hard
Type Safety โœ… Full โš ๏ธ Partial โŒ None

๐Ÿš€ Quick Start

Installation

pip install chaukas-sdk

Configuration

Set your environment variables (or pass them programmatically):

export CHAUKAS_TENANT_ID="your-tenant"
export CHAUKAS_PROJECT_ID="your-project"
export CHAUKAS_ENDPOINT="https://api.chaukas.ai"
export CHAUKAS_API_KEY="your-api-key"

Usage

OpenAI Agents

import chaukas
from openai import OpenAI
from openai.agents import Agent

# Enable instrumentation
chaukas.enable_chaukas()

# Your code works exactly as before
client = OpenAI()
agent = Agent(
    name="data-analyst",
    instructions="You are a helpful data analyst.",
    model="gpt-4o",
    client=client
)

result = await agent.run(
    messages=[{"role": "user", "content": "Analyze Q4 revenue"}]
)

# Chaukas automatically captures:
# โœ… Session start/end
# โœ… Agent lifecycle
# โœ… LLM invocations with tokens
# โœ… Tool calls and results
# โœ… Errors and retries
# โœ… Policy decisions
# โœ… State changes

CrewAI

import chaukas
from crewai import Agent, Task, Crew, Process

chaukas.enable_chaukas()

# Define your crew
researcher = Agent(
    role="Senior Research Analyst",
    goal="Uncover cutting-edge developments in AI",
    backstory="You're an expert at finding insights",
    verbose=True
)

task = Task(
    description="Research latest AI trends",
    agent=researcher,
    expected_output="A comprehensive report"
)

crew = Crew(
    agents=[researcher],
    tasks=[task],
    process=Process.sequential
)

# Full observability out of the box
result = crew.kickoff()

Google ADK

import chaukas
from adk import Agent

chaukas.enable_chaukas()

agent = Agent(name="assistant")
response = agent.run("Hello!")

๐Ÿ“Š Supported Frameworks

Chaukas SDK implements the chaukas-spec โ€” a standardized event schema with 19 event types for AI agent observability.

Framework Version Events Status Notes
OpenAI Agents >=0.5.0,<1.0.0 ๐ŸŽ‰ 19/19 ๐ŸŸข Production Session mgmt, MCP protocol, policy tracking, state updates, retries
CrewAI >=1.4.1,<2.0.0 ๐ŸŽ‰ 19/19 ๐ŸŸข Production Event bus integration, multi-agent handoffs, knowledge sources, guardrails, flows
Google ADK Latest ๐Ÿšง 5/19 ๐ŸŸก Under Construction Basic agent & LLM tracking

Coming Soon: LangChain, LangGraph, AutoGen, Microsoft Semantic Kernel

All frameworks implementing the complete chaukas-spec capture all 19 event types

๐ŸŽจ Event Types (chaukas-spec)

The chaukas-spec defines 19 standardized event types for AI agent observability. Chaukas SDK captures all of them automatically:

๐ŸŽญ Agent Lifecycle

SESSION_START       # User session begins
SESSION_END         # Session completes
AGENT_START         # Agent begins execution
AGENT_END           # Agent finishes
AGENT_HANDOFF       # Control transfers between agents

๐Ÿง  Model Operations

MODEL_INVOCATION_START  # LLM call initiated
MODEL_INVOCATION_END    # LLM responds (includes tokens, cost)

๐Ÿ› ๏ธ Tool Execution

TOOL_CALL_START     # Tool execution begins
TOOL_CALL_END       # Tool completes with result
MCP_CALL_START      # Model Context Protocol call starts
MCP_CALL_END        # MCP operation completes

๐Ÿ’ฌ I/O Tracking

INPUT_RECEIVED      # User input captured
OUTPUT_EMITTED      # Agent output generated

๐Ÿšจ Operational Intelligence

ERROR               # Error with full context
RETRY               # Automatic retry detected (rate limits, timeouts)
POLICY_DECISION     # Content filtering, guardrails enforced
DATA_ACCESS         # Knowledge base, file, or API access
STATE_UPDATE        # Agent configuration changes
SYSTEM_EVENT        # Framework initialization, shutdown

๐Ÿ”ฅ Advanced Features

Distributed Tracing

Every event includes full trace context:

{
  "event_id": "019a6700-adb9-718d-0bc9-0000415845aa",
  "session_id": "019a6700-adb7-7a30-a548-000077453f71",
  "trace_id": "019a6700-adb7-7ef3-1e46-0000ae993c28",
  "span_id": "019a6700-adb9-706a-0a26-000073699939",
  "parent_span_id": "019a6700-adb7-7b27-1858-0000ee8d895b",
  "type": "EVENT_TYPE_TOOL_CALL_END",
  "agent_id": "data-analyst",
  "timestamp": "2025-01-08T12:34:56.789Z"
}

Visualize complete request flows across:

  • Multiple agents
  • LLM calls
  • Tool invocations
  • External API calls

Intelligent Retry Detection

Chaukas automatically detects and tracks retries:

# Your code
try:
    result = await agent.run(messages)
except RateLimitError:
    await asyncio.sleep(2)  # Exponential backoff
    result = await agent.run(messages)  # Retry

# Chaukas captures:
# 1. ERROR event (rate limit)
# 2. RETRY event (attempt 1, exponential strategy, 2000ms delay)
# 3. MODEL_INVOCATION_START (retry attempt)
# 4. MODEL_INVOCATION_END (success)

MCP Protocol Support

Only SDK with native MCP instrumentation:

from agents import Agent
from agents.mcp import MCPServerStreamableHttp

# MCP server setup
mcp_server = MCPServerStreamableHttp(
    url="http://localhost:8000",
    server_name="documentation-server"
)

agent = Agent(
    name="doc-agent",
    model="gpt-4o",
    mcp_servers=[mcp_server]
)

# Chaukas captures:
# - MCP_CALL_START (get_prompt request)
# - MCP_CALL_END (prompt retrieved, 245ms)
# - Full request/response payloads

Policy Decision Tracking

Monitor content filtering and guardrails:

# When OpenAI filters content
response = await agent.run(messages)

# Chaukas automatically captures:
{
  "type": "EVENT_TYPE_POLICY_DECISION",
  "policy_id": "openai_content_policy",
  "outcome": "blocked",
  "rule_ids": ["content_filter"],
  "rationale": "Response blocked due to: content_filter",
  "finish_reason": "content_filter"
}

State Change Tracking

Track agent configuration changes:

# Agent configuration updated
agent.temperature = 0.7
agent.instructions = "Be more creative"

# Chaukas captures the diff:
{
  "type": "EVENT_TYPE_STATE_UPDATE",
  "state_update": {
    "temperature": {"old": 0.3, "new": 0.7},
    "instructions": {
      "old": "Be precise",
      "new": "Be more creative"
    }
  }
}

Multi-Agent Handoffs

Visualize agent collaboration:

# CrewAI agent handoff
task.context = [previous_task]

# Chaukas captures:
{
  "type": "EVENT_TYPE_AGENT_HANDOFF",
  "from_agent_id": "researcher",
  "to_agent_id": "writer",
  "handoff_reason": "task_delegation",
  "context_data": {...}
}

โš™๏ธ Configuration

Environment Variables

Required

CHAUKAS_TENANT_ID       # Your tenant identifier
CHAUKAS_PROJECT_ID      # Your project identifier
CHAUKAS_ENDPOINT        # API endpoint (api mode)
CHAUKAS_API_KEY         # Authentication key (api mode)

Optional

CHAUKAS_OUTPUT_MODE="api"              # "api" or "file"
CHAUKAS_OUTPUT_FILE="events.jsonl"     # File path (file mode)
CHAUKAS_BATCH_SIZE=20                  # Events per batch
CHAUKAS_MAX_BATCH_BYTES=262144         # Max batch size (256KB)
CHAUKAS_FLUSH_INTERVAL=5.0             # Auto-flush interval (seconds)
CHAUKAS_TIMEOUT=30.0                   # Request timeout (seconds)
CHAUKAS_BRANCH="main"                  # Git branch for context
CHAUKAS_TAGS="prod,us-east-1"          # Custom tags

Framework-Specific

CREWAI_DISABLE_TELEMETRY=true  # Disable CrewAI's telemetry

Programmatic Configuration

import chaukas

chaukas.enable_chaukas(
    tenant_id="acme-corp",
    project_id="production",
    endpoint="https://observability.acme.com",
    api_key="sk-proj-...",
    session_id="custom-session-123",  # Optional custom session
    config={
        "auto_detect": True,          # Auto-detect installed SDKs
        "enabled_integrations": [     # Or specify explicitly
            "openai_agents",
            "crewai"
        ],
        "batch_size": 20,             # Default batch size
        "flush_interval": 10.0,
        "timeout": 60.0,
    }
)

File Output Mode (Development)

Perfect for local development and testing:

import os
os.environ["CHAUKAS_OUTPUT_MODE"] = "file"
os.environ["CHAUKAS_OUTPUT_FILE"] = "agent_events.jsonl"

import chaukas
chaukas.enable_chaukas()

# Events written to agent_events.jsonl
# Analyze with: cat agent_events.jsonl | jq .type | sort | uniq -c

๐Ÿ“– Examples

Example 1: Debug LLM Token Usage

import chaukas
chaukas.enable_chaukas()

# Run your agent
result = await agent.run(messages)

# Query events:
# cat events.jsonl | jq 'select(.type=="EVENT_TYPE_MODEL_INVOCATION_END") | .model_invocation.usage'

# Output:
{
  "prompt_tokens": 234,
  "completion_tokens": 456,
  "total_tokens": 690,
  "estimated_cost_usd": 0.0207
}

Example 2: Track Multi-Agent Workflow

import chaukas
from crewai import Agent, Task, Crew, Process

chaukas.enable_chaukas()

# Define a multi-agent crew
researcher = Agent(role="Researcher", goal="Find insights")
writer = Agent(role="Writer", goal="Write report")

research_task = Task(description="Research AI trends", agent=researcher)
writing_task = Task(
    description="Write report",
    agent=writer,
    context=[research_task]  # Handoff point
)

crew = Crew(agents=[researcher, writer], tasks=[research_task, writing_task])
result = crew.kickoff()

# Chaukas captures:
# 1. SESSION_START
# 2. AGENT_START (researcher)
# 3. MODEL_INVOCATION_* (researcher's LLM calls)
# 4. AGENT_END (researcher)
# 5. AGENT_HANDOFF (researcher โ†’ writer)
# 6. AGENT_START (writer)
# 7. MODEL_INVOCATION_* (writer's LLM calls)
# 8. AGENT_END (writer)
# 9. SESSION_END

Example 3: Monitor Tool Execution

import chaukas
from openai import OpenAI
from openai.agents import Agent

chaukas.enable_chaukas()

def search_database(query: str) -> str:
    """Search the product database."""
    # Slow database query
    import time
    time.sleep(2)
    return f"Results for: {query}"

agent = Agent(
    name="support-agent",
    model="gpt-4o",
    tools=[search_database]
)

result = await agent.run(messages=[
    {"role": "user", "content": "Find product XYZ"}
])

# Chaukas captures tool performance:
# TOOL_CALL_START โ†’ TOOL_CALL_END
# Duration: 2.1s (flag for optimization!)

Example 4: Detect Rate Limit Issues

import chaukas
chaukas.enable_chaukas()

# Your code encounters rate limits
for i in range(100):
    try:
        result = await agent.run(messages)
    except RateLimitError as e:
        await asyncio.sleep(2 ** i)  # Exponential backoff
        continue

# Query retry events:
# cat events.jsonl | jq 'select(.type=="EVENT_TYPE_RETRY")'

# Output shows patterns:
# - 15 retries in last hour
# - Average backoff: 4.2s
# - All due to rate limits (429)
# โ†’ Action: Implement request throttling

๐Ÿ—๏ธ Architecture

How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Your Application                                           โ”‚
โ”‚                                                             โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                   โ”‚
โ”‚  โ”‚ OpenAI      โ”‚         โ”‚   CrewAI     โ”‚                   โ”‚
โ”‚  โ”‚ Agent       โ”‚         โ”‚   Crew       โ”‚                   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                   โ”‚
โ”‚         โ”‚                       โ”‚                           โ”‚
โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                           โ”‚
โ”‚                     โ”‚                                       โ”‚
โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                           โ”‚
โ”‚         โ”‚  Chaukas SDK          โ”‚   (Monkey patching)       โ”‚
โ”‚         โ”‚  - Auto-detection     โ”‚                           โ”‚
โ”‚         โ”‚  - Event capture      โ”‚                           โ”‚
โ”‚         โ”‚  - Distributed trace  โ”‚                           โ”‚
โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                           โ”‚
โ”‚                     โ”‚                                       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚  Intelligent Batching โ”‚
          โ”‚  - Adaptive sizing    โ”‚
          โ”‚  - Auto-retry         โ”‚
          โ”‚  - Memory-efficient   โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚   Transmission        โ”‚
          โ”‚   - gRPC (API mode)   โ”‚
          โ”‚   - File (Dev mode)   โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚  Chaukas Platform     โ”‚
          โ”‚  - Storage            โ”‚
          โ”‚  - Querying           โ”‚
          โ”‚  - Visualization      โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Event Flow

Agent.run() called
    โ”‚
    โ”œโ”€โ†’ SESSION_START (first call)
    โ”‚
    โ”œโ”€โ†’ AGENT_START
    โ”‚
    โ”œโ”€โ†’ INPUT_RECEIVED (user message)
    โ”‚
    โ”œโ”€โ†’ MODEL_INVOCATION_START
    โ”‚   โ”‚
    โ”‚   โ””โ”€โ†’ [LLM processes]
    โ”‚
    โ”œโ”€โ†’ MODEL_INVOCATION_END (with tokens)
    โ”‚
    โ”œโ”€โ†’ TOOL_CALL_START (if tools requested)
    โ”‚   โ”‚
    โ”‚   โ””โ”€โ†’ [Tool executes]
    โ”‚
    โ”œโ”€โ†’ TOOL_CALL_END (with result)
    โ”‚
    โ”œโ”€โ†’ OUTPUT_EMITTED (agent response)
    โ”‚
    โ”œโ”€โ†’ AGENT_END
    โ”‚
    โ””โ”€โ†’ SESSION_END (on cleanup)

Distributed Tracing Hierarchy

Session (lifetime of user interaction)
  โ”‚
  โ”œโ”€ Trace (single request/response)
  โ”‚   โ”‚
  โ”‚   โ”œโ”€ Agent Span (agent execution)
  โ”‚   โ”‚   โ”‚
  โ”‚   โ”‚   โ”œโ”€ LLM Span (model call)
  โ”‚   โ”‚   โ”‚
  โ”‚   โ”‚   โ”œโ”€ Tool Span (tool execution)
  โ”‚   โ”‚   โ”‚   โ”‚
  โ”‚   โ”‚   โ”‚   โ””โ”€ MCP Span (MCP protocol call)
  โ”‚   โ”‚   โ”‚
  โ”‚   โ”‚   โ””โ”€ Tool Span (another tool)
  โ”‚   โ”‚
  โ”‚   โ””โ”€ Agent Span (handoff to second agent)
  โ”‚       โ”‚
  โ”‚       โ””โ”€ LLM Span
  โ”‚
  โ””โ”€ Trace (follow-up request)
      โ””โ”€ ...

๐ŸŽฏ Use Cases

Production Monitoring

  • Track agent reliability and uptime
  • Monitor LLM token costs in real-time
  • Detect performance regressions
  • Alert on error spikes

Debugging & Development

  • Reproduce issues with full trace context
  • Understand agent decision-making
  • Optimize tool execution performance
  • Test multi-agent workflows

Compliance & Audit

  • Immutable audit trail of all interactions
  • Track policy enforcement decisions
  • Monitor data access patterns
  • Generate compliance reports

Cost Optimization

  • Identify expensive LLM calls
  • Track token usage by agent/model
  • Find opportunities for caching
  • Optimize prompt engineering

๐Ÿ”ง Batching & Performance

Adaptive Batching

Chaukas implements intelligent batching to optimize performance:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Event Buffer                           โ”‚
โ”‚                                         โ”‚
โ”‚  Events accumulate until:              โ”‚
โ”‚  โ€ข batch_size reached (default: 20)    โ”‚
โ”‚  โ€ข max_batch_bytes reached (256KB)     โ”‚
โ”‚  โ€ข flush_interval elapsed (5s)         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚
              โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Send to Server  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
    Success? โ”€โ”€โ”€โ”€Yesโ”€โ”€โ†’ โœ… Done
         โ”‚
        No (503)
         โ”‚
         โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Split batch in halfโ”‚
    โ”‚ Retry both halves  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Performance Characteristics

  • Overhead: < 1% CPU impact
  • Memory: ~10MB for 1000 events buffered
  • Latency: < 5ms per event capture
  • Network: Batched transmission reduces API calls by 95%

Tuning for Your Use Case

# High-volume production (optimize throughput)
chaukas.enable_chaukas(config={
    "batch_size": 200,
    "max_batch_bytes": 1_048_576,  # 1MB
    "flush_interval": 30.0
})

# Real-time debugging (optimize latency)
chaukas.enable_chaukas(config={
    "batch_size": 1,
    "flush_interval": 0.1
})

# Memory-constrained (optimize memory)
chaukas.enable_chaukas(config={
    "batch_size": 10,
    "max_batch_bytes": 65536,  # 64KB
    "flush_interval": 2.0
})

๐Ÿ› Troubleshooting

Common Issues

CrewAI "Service Unavailable" Errors

Problem: Seeing "Transient error Service Unavailable" when using CrewAI

Cause: CrewAI's built-in telemetry trying to send data to their servers

Solution:

export CREWAI_DISABLE_TELEMETRY=true

This only disables CrewAI's telemetry. Chaukas continues capturing events normally.

Events Not Appearing

Problem: No events in output file or API

Solution:

# Enable debug logging
import logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("chaukas.sdk").setLevel(logging.DEBUG)

# Verify configuration
import chaukas
chaukas.enable_chaukas()
print(chaukas.get_config())  # Check settings

# Force flush before exit
chaukas.flush()
chaukas.disable_chaukas()

High Memory Usage

Problem: Memory consumption increasing over time

Cause: Large batches accumulating

Solution:

# Reduce batch size and increase flush frequency
chaukas.enable_chaukas(config={
    "batch_size": 10,
    "max_batch_bytes": 65536,
    "flush_interval": 1.0
})

503 Errors from API

Problem: Server returning "high memory" errors

Cause: Batches too large

Solution: SDK automatically splits batches and retries. If persistent:

chaukas.enable_chaukas(config={
    "max_batch_bytes": 131072,  # Reduce to 128KB
    "batch_size": 50             # Smaller batch count
})

๐Ÿ“š Documentation

๐Ÿงช Development

Setup

git clone https://github.com/chaukasai/chaukas-sdk
cd chaukas-sdk
pip install -e ".[dev]"

Running Tests

# All tests
pytest

# With coverage
pytest --cov=chaukas

# Specific test file
pytest tests/test_openai_events.py -v

# Watch mode
pytest-watch

Code Quality

# Format code
black src/ tests/ examples/

# Sort imports
isort src/ tests/ examples/

# Type checking
mypy src/chaukas/

# Run all checks
make lint

Running Examples

# OpenAI Agents example
python examples/openai/openai_comprehensive_example.py

# CrewAI example
python examples/crewai/crewai_example.py

# Analyze captured events
cat events.jsonl | jq .type | sort | uniq -c

๐Ÿค Contributing

We welcome contributions from the community! Whether you're:

  • ๐Ÿ› Reporting bugs
  • ๐Ÿ’ก Requesting features
  • ๐Ÿ“– Improving documentation
  • ๐Ÿ”ง Contributing code
  • โ“ Asking questions

Please read our Contributing Guide for detailed guidelines on:

  • Setting up your development environment
  • Coding standards and best practices
  • Testing requirements
  • Pull request process

Quick Start for Contributors

  1. Fork and clone the repository
  2. Install dependencies: pip install -e ".[dev]"
  3. Make your changes following our coding standards
  4. Run tests: make test && make lint
  5. Submit a PR using our PR template

Report Issues

Found a bug or have a feature request? Please use our issue templates:

Community Guidelines

Please follow our Code of Conduct to keep our community welcoming and inclusive.

For security vulnerabilities, please see our Security Policy.

๐ŸŒŸ Community

๐Ÿ“ฌ Support

๐Ÿ“„ License

Apache 2.0 License - see LICENSE file for details


Built with โค๏ธ by the Chaukas team

Website โ€ข chaukas-spec โ€ข GitHub

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

chaukas_sdk-0.1.0.tar.gz (92.3 kB view details)

Uploaded Source

Built Distribution

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

chaukas_sdk-0.1.0-py3-none-any.whl (74.2 kB view details)

Uploaded Python 3

File details

Details for the file chaukas_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: chaukas_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 92.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chaukas_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5591685f720c2c05ac736c1f699737fa191198f34a9a53b62f2a639b4fb421c4
MD5 e9862ea2319330ca61686c0364bc583e
BLAKE2b-256 7fff2f906f7ac2f52c7787ba5103861aecfcb91714e52cd09d6eef9ebb3b8e22

See more details on using hashes here.

Provenance

The following attestation bundles were made for chaukas_sdk-0.1.0.tar.gz:

Publisher: release.yml on chaukasai/chaukas-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 chaukas_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chaukas_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 74.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chaukas_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17b68155e8c96baee756d772e388e00aed785ee3a5c1b9881a7fdfab40c197d9
MD5 0021682f25d18317c86c9bc7d43cd978
BLAKE2b-256 a5c66ee7f95e1974a30e013da3fd11faf56b170001953c7fc928876e1e6d7a37

See more details on using hashes here.

Provenance

The following attestation bundles were made for chaukas_sdk-0.1.0-py3-none-any.whl:

Publisher: release.yml on chaukasai/chaukas-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