SideSeat Class
The SideSeat class is the main entry point for the Python SDK. It manages OpenTelemetry setup, framework instrumentation, and exporters.
Class Definition
Section titled “Class Definition”class SideSeat: def __init__( self, endpoint: str | None = None, project_id: str | None = None, api_key: str | None = None, framework: str | list[str] | None = None, auto_instrument: bool = True, service_name: str | None = None, service_version: str | None = None, enable_traces: bool = True, enable_metrics: bool = True, enable_logs: bool = False, capture_content: bool = True, encode_binary: bool = True, disabled: bool = False, debug: bool = False, ) -> None: ...Properties
Section titled “Properties”config
Section titled “config”Immutable configuration object.
client = SideSeat()print(client.config.endpoint)print(client.config.project_id)telemetry
Section titled “telemetry”Access to the underlying telemetry client for debug exporters.
client = SideSeat()client.telemetry.setup_console_exporter()client.telemetry.setup_file_exporter("traces.jsonl")tracer_provider
Section titled “tracer_provider”The OpenTelemetry TracerProvider instance managing trace collection.
client = SideSeat()provider = client.tracer_provider
# Force flush all pending spansprovider.force_flush()is_disabled
Section titled “is_disabled”Whether telemetry is disabled.
client = SideSeat()if client.is_disabled: print("Telemetry is disabled")Methods
Section titled “Methods”span(name, **kwargs)
Section titled “span(name, **kwargs)”Create a custom span for tracing.
Parameters:
name(str): Span nameuser_id(str, optional): Override user ID for this span and its childrensession_id(str, optional): Override session ID for this span and its children
Returns: ContextManager[Span]
client = SideSeat()
with client.span("my-operation") as span: span.set_attribute("custom_key", "value") result = process_request()# Errors are automatically recorded with stack tracePer-operation identity override:
with client.span("user-request", user_id="user-456", session_id="session-xyz"): do_work() # This span and children get overridden IDstrace(name, **kwargs)
Section titled “trace(name, **kwargs)”Create a root span that groups child spans into a single trace.
Parameters:
name(str): Trace nameuser_id(str, optional): User ID for this trace and its childrensession_id(str, optional): Session ID for this trace and its children
Returns: ContextManager[Span]
with client.trace("multi-turn-chat"): openai.chat.completions.create(model="gpt-5-mini", messages=messages) openai.chat.completions.create(model="gpt-5-mini", messages=messages)get_tracer(name)
Section titled “get_tracer(name)”Get an OpenTelemetry tracer.
Parameters:
name(str): Tracer name
Returns: Tracer
client = SideSeat()tracer = client.get_tracer("my-module")
with tracer.start_as_current_span("operation"): # ... work ... passforce_flush(timeout_millis)
Section titled “force_flush(timeout_millis)”Export pending spans immediately.
Parameters:
timeout_millis(int): Timeout in milliseconds. Default:30000
Returns: bool
client = SideSeat()# ... do work ...success = client.force_flush(timeout_millis=5000)validate_connection(timeout)
Section titled “validate_connection(timeout)”Test server connectivity.
Parameters:
timeout(float): Timeout in seconds. Default:5.0
Returns: bool
client = SideSeat()if client.validate_connection(): print("Server is reachable")shutdown(timeout_millis)
Section titled “shutdown(timeout_millis)”Gracefully shutdown all exporters, flushing pending spans.
Parameters:
timeout_millis(int): Timeout in milliseconds. Default:30000
Returns: None
client = SideSeat()# ... do work ...client.shutdown()Context Manager
Section titled “Context Manager”Use the context manager for automatic shutdown:
with SideSeat() as client: # Your code runs with tracing enabled run_my_agent()# Traces flushed and shutdown automaticallyUsage Patterns
Section titled “Usage Patterns”Basic Usage
Section titled “Basic Usage”from sideseat import SideSeat
client = SideSeat()
# Your code runs with tracing enabled# ...
# Optional: explicit shutdownclient.shutdown()With Framework Selection
Section titled “With Framework Selection”from sideseat import SideSeat, Frameworks
client = SideSeat(framework=Frameworks.Strands)With Custom Configuration
Section titled “With Custom Configuration”client = SideSeat( endpoint="http://localhost:5388", project_id="my-project", service_name="my-agent", service_version="1.0.0",)With Provider Instrumentation
Section titled “With Provider Instrumentation”from sideseat import SideSeat, Frameworks
client = SideSeat(framework=Frameworks.OpenAI)# orclient = SideSeat(framework=Frameworks.Bedrock)With Debug Exporters
Section titled “With Debug Exporters”client = SideSeat()client.telemetry.setup_console_exporter() # Print spansclient.telemetry.setup_file_exporter("traces.jsonl") # Write to fileUser and Session Tracking
Section titled “User and Session Tracking”Set user_id and session_id via trace() or span():
from sideseat import SideSeat
client = SideSeat()
# Group traces into a sessionwith client.trace("chat", session_id="session-abc", user_id="user-123"): run_agent() # This span and children get user.id and session.id
# Or on any spanwith client.span("handle-request", user_id="user-456", session_id="session-xyz"): do_work()Disabled Mode
Section titled “Disabled Mode”# For testing/CIclient = SideSeat(disabled=True)# Or: SIDESEAT_DISABLED=trueThread Safety
Section titled “Thread Safety”The SideSeat class is thread-safe:
- Multiple threads can create spans concurrently
shutdown()can be called from any thread- Exporters use internal locking
import threading
client = SideSeat()
def worker(): with client.span("worker"): # ... work ... pass
threads = [threading.Thread(target=worker) for _ in range(10)]for t in threads: t.start()for t in threads: t.join()
client.shutdown()Next Steps
Section titled “Next Steps”- Configuration — all configuration options
- Exporters — debug exporters for development