Tracing decorators provide a simple way to automatically trace function calls and add telemetry to your AI applications without modifying the core logic.
from synth_ai.tracing_v3.decorators import with_session@with_session(require=True)def my_ai_function(): # This function requires an active session # Will raise error if no session is active pass@with_session(require=False) def optional_tracing_function(): # This function works with or without a session # Tracing is optional pass
from synth_ai.tracing_v3.decorators import trace_llm_call@trace_llm_calldef call_language_model(prompt: str) -> str: # Function logic here return lm.respond(prompt)# Usage - automatically traced when session is activeresult = call_language_model("Hello!")