Skip to main content
Context-isolated runtime and tool resolution prevents agents from interfering with each other when running concurrently in the same process.
The user runs agents concurrently; each agent keeps isolated runtime and tool state.

Quick Start

1

Default Behavior (Safe)

Each agent automatically gets its own context-isolated runtime and tool resolver:
2

Multi-Project Tool Resolution

Agents in different working directories get their own tool resolver anchored to their CWD:

How It Works

Context variables (contextvars.ContextVar) automatically isolate state per execution context. Each agent/task/request gets its own:
  • Interactive runtime with separate LSP/ACP configurations
  • Tool resolver anchored to its own working directory
  • Memory and cache state that won’t leak between agents

Configuration Options

The context safety is automatic - no configuration required. However, there are some control points:

Common Patterns

Pattern 1: Daemon with Project Switching

Pattern 2: Concurrent Multi-Agent Workflow

Pattern 3: IDE Plugin Integration


Best Practices

When switching working directories in long-lived processes, explicitly reset the tool resolver to pick up the new directory’s tools.py.
Don’t manually manage context variables - the framework handles isolation automatically. Each async task or thread gets its own context.
When cleaning up resources, use the context-local versions that only affect the current agent’s context.
Each context anchors its tool resolver to the working directory when first called. Use this for clean project separation.

Thread Safety

Thread-safe agent operations and state management

Tool Resolver

Context-aware tool resolution and loading