qfa.services.call_context#

Request-scoped ContextVar carrying tenant + operation to tracking adapters.

The orchestrator enters call_scope(...) at each public-method entry; the TrackingLLMAdapter reads current_call_context.get() at LLM-call time. asyncio propagates ContextVars across create_task / gather via snapshot-on-spawn, so fan-out from a public orchestrator method preserves the context without explicit forwarding.

Functions

call_scope(tenant_id, operation)

Set current_call_context for the duration of the block.

qfa.services.call_context.call_scope(tenant_id: str, operation: Operation) AsyncIterator[CallContext][source]#

Set current_call_context for the duration of the block.

Parameters:
  • tenant_id (str) – Tenant making the call.

  • operation (Operation) – Public orchestrator operation issuing the call.

Yields:

CallContext – The context that was set.