Installation

Grab the latest stable release from PyPI

pip install synth-sdk --upgrade

Or using uv (recommended for faster installation):

pip install synth-sdk --upgrade

Overview

The Synth SDK automatically logs all interactions between your agent and AI models:

  • Input/output messages
  • Tool calls and responses
  • Model parameters
  • Execution metadata

Core Components

Decorators

  • @trace_event_sync - Tracks synchronous function execution
  • @trace_event_async - Tracks asynchronous function execution

Example Usage

from synth_sdk import trace_event_sync, OpenAI

os.environ["SYNTH_LOGGING_MODE"] = "instant"

class Agent:
    def __init__(self):
        self.system_instance_id = "agent_1"  # Unique instance identifier
        self.system_name = "support_agent"   # Agent type identifier
        self.client = OpenAI()

    @trace_event_sync(event_type="customer_response") # AI call identifier
    def respond_to_customer(self, query: str) -> str:
        response = self.client.chat.completions.create(
            model="gpt-4o-mini",
            messages=[{"role": "user", "content": query}]
        )
        return response.choices[0].message.content

Documentation