Example
This is a synchronous context manager. Inside
async def code, use plain with (not async with); async with raises TypeError because the underlying generator does not implement the async context manager protocol. For async agents, prefer the @observe decorator.Parameters
Galtea trace ID to link spans to. When provided, the wrapper manages the Galtea span context automatically for the duration of the block.
Langfuse observation type:
span (default), generation, agent, tool, retriever, chain, evaluator, embedding, guardrail. Mapped to Galtea’s SpanType automatically. See observation types.start_as_current_observation.
Yields
A Langfuse observation span object. Supports all native Langfuse span methods:Nested Observations
Only the root call needs the Galtea wrapper. Child observations created viaroot.start_as_current_observation(...) are native Langfuse — they are automatically linked to Galtea while the root context is active.