Skip to main content

Overview

Composo’s tracing module provides automatic instrumentation for LLM calls and manual tracking for multi-agent systems. Capture detailed interaction data to evaluate agent performance and debug complex workflows.

ComposoTracer

Initialize automatic instrumentation for LLM provider APIs.

init()

Configure tracing for one or more LLM providers.

Parameters

instruments
Instruments | list[Instruments]
Single instrument or list of instruments to enable tracing for.Available Instruments:
  • Instruments.OPENAI: Trace OpenAI API calls
  • Instruments.ANTHROPIC: Trace Anthropic API calls
  • Instruments.GOOGLE_GENAI: Trace Google Gemini API calls
If None, initializes tracing without provider-specific instrumentation.

Examples

Single Provider
Multiple Providers

AgentTracer

Context manager for tracking agent interactions and organizing traces by agent.

Constructor

Parameters

name
string
Human-readable agent name. If not provided, generates a name like agent_abc123.
agent_id
string
Unique identifier for the agent. If not provided, generates a UUID.

Usage as Context Manager

Nested Agents

Track hierarchical agent systems with parent-child relationships:

@agent_tracer Decorator

Decorator for automatically tracing agent functions.

Parameters

name
string
Agent name. If not provided, uses the function name.

Examples

Basic Usage
Multi-Agent Workflow
Async Functions

Complete Example: Multi-Agent System


Instruments Enum

Available instrumentation providers:
Instruments.OPENAI
enum
Automatically trace OpenAI API calls (chat, completions, embeddings, etc.)
Instruments.ANTHROPIC
enum
Automatically trace Anthropic API calls (Claude models)
Instruments.GOOGLE_GENAI
enum
Automatically trace Google Gemini API calls