Commit Graph

2 Commits

Author SHA1 Message Date
Devin AI
00e963aeb3 fix: propagate contextvars.Context in execute_async() thread
Use contextvars.copy_context() to capture the calling thread's context
and run the worker thread target via ctx.run() so that ContextVar values
(used by OpenTelemetry, Langfuse, and other tracing libraries) are
preserved inside async task execution threads.

Previously, threading.Thread() was used without copying context, causing
all ContextVar values to silently reset to defaults in worker threads.

Fixes #4822

Co-Authored-By: João <joao@crewai.com>
2026-03-12 06:18:25 +00:00
Greyson LaLonde
9b8f31fa07 feat: async task support (#4024)
* feat: add async support for tools, add async tool tests

* chore: improve tool decorator typing

* fix: ensure _run backward compat

* chore: update docs

* chore: make docstrings a little more readable

* feat: add async execution support to agent executor

* chore: add tests

* feat: add aiosqlite dep; regenerate lockfile

* feat: add async ops to memory feat; create tests

* feat: async knowledge support; add tests

* feat: add async task support

* chore: dry out duplicate logic
2025-12-04 13:34:29 -08:00