Skip to main content
Under async execution, PraisonAI dispatches blocking I/O to worker threads so parallel tasks actually run in parallel, and the built-in in-memory store stays safe under concurrent writes.
Both knowledge.search(...) and task-callback memory writes are offloaded automatically — you don’t call anything new. What you see is parallel async tasks that share a knowledge base or memory now actually running in parallel.

Quick Start

1

Parallel agents sharing knowledge

An asyncio.gather(...) of agents that query the same knowledge base runs in parallel — no lookup blocks the loop.
2

Parallel tasks writing memory

Task-callback memory writes offload to worker threads, so a fan-out of tasks doesn’t stall on one slow write.

How It Works

What runs off the event loop

Both were synchronous embedding + vector-store / DB calls that previously blocked the event loop for the whole coroutine lifetime. An asyncio.gather(...) fan-out would serialise on the slowest lookup or write instead of running concurrently. Offloading them to threads keeps the loop free.
This is transparent — there is no user-facing knob to opt out. You do not call anything new; parallel async tasks simply run in parallel.

Thread-safe in-memory adapter

The built-in InMemoryAdapter guards its store, search, delete, and reset methods with a re-entrant lock (RLock). Once writes move off the event loop, parallel async writes from an asyncio.gather(...) fan-out cannot produce duplicate ids or lose entries. If you write a custom adapter that will be shared across async agents, do the same — guard its mutating methods with a lock.

Best Practices

Knowledge search and memory writes offload to threads, so a gather(...) of agents that share a knowledge base or memory runs in parallel instead of serialising on the slowest task.
Custom memory adapters used from async task callbacks receive writes from multiple worker threads. Guard mutating methods with a lock, as the built-in InMemoryAdapter does with an RLock.
The offload is automatic and transparent. There is no flag to enable or disable it — the sync path is unchanged and the async path always stays responsive.

Knowledge

Add document knowledge with async-safe search

Memory

Persistent memory with offloaded, thread-safe writes

Async Agents

Run agents and tasks concurrently with asyncio

Custom Memory Adapters

Build your own adapter — guard it with a lock for async use