Skip to main content

obs_context

Function obs_context 

Source
pub fn obs_context(
    fallback_agent_id: Option<&str>,
) -> (String, String, String, String)
Expand description

Build the observability context tuple (trace_id, run_id, agent_id, agent_name).

Resolution order for agent_id:

  1. AGENT_BLOCK_AGENT_ID environment variable (non-empty)
  2. fallback_agent_id argument (non-None)
  3. Process-scoped auto-generated UUID v4 (generated once per process lifetime). Scope: one agent-block execution = one agent_id. Conceptually coarser than run_id (per-call), though both may share the same value in simple invocations.