Skip to main content

copy_context_to_callable

Function
This function is defined in the context_events module.
Wrap a callable to copy the current context to the new thread/executor. This is needed because contextvars are NOT automatically propagated to thread pool executors. Use this when calling run_in_executor().

Signature

Parameters

Any
required
The callable to wrap.

Returns

Any
A wrapped callable that copies the current context.

Usage

Uses

  • contextvars.copy_context
  • ctx.run

Used By

Source

View on GitHub

praisonaiagents/trace/context_events.py at line 117

Context Concept

Context Management

Context Strategies