Framework · Orchestration Frameworks

TaskWeaver

Code-first agent framework that converts user requests into executable Python code, preserves in-memory state (variables, DataFrames) across turns, and orchestrates user-defined plugins as callable functions.

Description

TaskWeaver (arXiv 2311.17541) is Microsoft Research Asia's code-first agent framework for data analytics. Its distinguishing design choice is preserving the Python interpreter's in-memory state across conversational turns — DataFrames, intermediate variables, and rich data structures persist so subsequent turns can refer to them by name rather than re-loading or re-serialising. A planner decomposes the user request into tasks, a code generator emits Python that calls user-defined plugins, and an executor runs the code with the persisted state. Code verification before execution and reflective adjustment after errors are first-class.

Solution

Planner emits a typed plan over the user request. CodeInterpreter generates Python that invokes the plan's user-defined plugins (each plugin is a typed Python callable). The Executor runs the code in a persistent Python interpreter session, so all state from prior turns is alive. Code is checked before execution and the agent reflects on errors to adjust subsequent code generation.

Primary use cases

  • multi-turn data analytics where in-memory state (DataFrames) carries across turns
  • domain adaptation via plugins encapsulating proprietary algorithms
  • verifiable code-execution flows (pre-execution check + post-execution reflection)
  • research baseline for code-first vs. text-first agent architectures

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.