Skip to content

Glossary: Multi-Agent Systems

Context variable

Also written: ContextVar, contextvars.ContextVar

A Python value, created with `contextvars.ContextVar`, that follows the code wherever it runs, including into threads started with `asyncio.to_thread`. It can hold the ID of the current span so that child spans link to their parent.

Where the book teaches it

Related terms

SpanTrace treeasyncio.to_thread