Learning resourcesReviewed · Pydantic

Pydantic AI Harness Planning Guide

This guide teaches Python developers how to give Pydantic AI agents structured task lists, but persistence and prompt caching require additional configuration. It covers task tools, subtasks, dependencies, storage, events and recovery after conversation compaction. Storage errors stop runs by default, and the documented 0.x API may change between minor releases.

Researched 15 Nov 2026

In short.

This guide explains Pydantic AI Harness's Planning capability for Python developers building multistep agents, with storage reliability and separately configured prompt caching as its main operational catches. Planning supplies model-controlled task tools and keeps changing plans in conversation history instead of the system prompt. Optional features include persistent stores, dependency tracking, events and shared plans across separate runs. The page explains failure behavior and integration caveats in useful detail, but provides no measured reliability, latency or cost results. No examples were executed; installation requirements, licensing and exact release compatibility remain unknown.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete selected page at [https://pydantic.dev/docs/ai/harness/planning/index.md], including usage, tools, persistence, events, caching, agent specifications, migration guidance, API reference and version/deprecation notices. Linked pages, the documentation index, implementation source, provider documentation and separate license files are excluded. The page's documentation-fetching notices do not establish runtime requirements for Planning. Examples, storage behavior, cache effects, UI history handling and durable replay were not executed or independently verified. Exact package version, installation compatibility, operating cost and licensing remain unknown.

The overview

Identity

The resource is the Planning documentation page for Pydantic AI Harness at [https://pydantic.dev/docs/ai/harness/planning/index.md]. Planning attaches to a Pydantic AI Agent through its capabilities configuration and gives the model tools for maintaining a task checklist. The page combines usage examples, storage guidance, configuration options, migration notes and an API reference.

Assessment

The guide is useful when an agent needs to track unfinished work across a long conversation or resume a stored plan. Its strongest material explains where plan state lives, when reminders are added and what happens when storage or conversation history changes. It supports an informed implementation decision, but does not establish that agents follow plans more accurately or that caching produces a particular saving. Those outcomes were not assessed.

Users

The main audience is Python developers building agents with Pydantic AI. Beginners can start with an in-memory checklist, but need familiarity with Python imports, Agent construction and model tool calls. Developers handling longer workflows can use the sections on shared storage, events, conversation compaction and durable execution. Existing pydantic-ai-todo users also get specific migration guidance.

Capabilities

Six tools are registered by default: write_plan, read_plan, add_task, update_task_status, update_task_statuses and remove_task. They support replacing a complete plan or editing individual tasks through stable IDs. Tasks have pending, in_progress, completed or cancelled status. Batch status updates are validated all-or-nothing; keeping exactly one task in_progress is documented as a convention.

Setting enable_subtasks=True adds child tasks, dependencies, a blocked status and get_available_tasks. Dependencies unblock when prerequisites are completed or cancelled; self-dependencies, cycles and duplicates are rejected. Typed events cover creation, updates, status changes, completion and deletion. Direct store mutations do not produce these run events.

Using it

Requirements

The examples assume Pydantic AI, Pydantic AI Harness and a configured model. Installation commands, supported Python versions, dependency pins and authentication steps are not specified. Persistent storage is optional: SQLite requires a file-backed database; PostgreSQL uses a caller-owned asyncpg pool, and Redis uses a caller-owned redis.asyncio client. SQLite stores its database on the machine running the agent, rather than in the workspace. Supported durable engines with separate tool workers require a persistent store or store_resolver.

Mechanism

With injection enabled, tools that change the plan append the whole checklist inside a <plan_reminder> tag to their results. Static system guidance explains that tag, while the changing plan stays in conversation history. Task text has its tags escaped. This arrangement is intended to preserve the reusable prompt prefix when the plan changes.

Before each model request, Planning reads the store and uses metadata to identify the latest plan still visible to the model. If it is absent or differs from stored state, Planning records the current plan on the user channel. This covers compaction, externally changed plans and a separate run starting without prior history. With a supported durable-execution capability, store operations are journaled and replay reuses recorded results.

Setup

The basic pattern imports Agent from pydantic_ai and Planning from pydantic_ai_harness, then constructs an agent with capabilities=[Planning()]. Each run receives a fresh, isolated in-memory plan by default. A tools allowlist can reduce the surface to tools=['write_plan']; enable_subtasks=True enables hierarchical planning.

For persistence, the page demonstrates Planning(store=SqlitePlanStore('plan.db', session='user-123')). A store_resolver can choose a store per run. YAML or JSON agent specifications are also supported; the Python loading example passes custom_capability_types=[Planning]. These are documented configurations, not executed setup results.

Example

One example asks an agent equipped with Planning to refactor an authentication module and add tests. Planning provides the checklist tools; the example does not demonstrate file-editing tools, test execution or a completed refactor. Another example shares a SQLite store between a planning agent and an executing agent. The executor receives the plan without the planner's message history, so investigation details needed for implementation must be captured in that plan. Neither example was executed.

Assessment & evidence

Limitations

A store error fails the run by default. Retry or fallback behavior belongs in the store implementation or a wrapper. Planning also does not enforce a planning agent's read-only behavior; available tools and agent instructions determine that boundary.

Client-returned history can lose identifying metadata; the page specifically names AG-UI. This can cause another plan record to be added, and compaction may preserve an older record as a user turn. Setting inject=False disables the reminder mechanism, although write_plan still returns a bare checklist. Durable recovery, provider compatibility and behavior under concurrent use were not independently assessed.

Reasoning

The design trades repeated plan text and storage access for explicit progress state and a stable system-prompt prefix. Whole-plan replacement avoids tracking mutable list positions, while granular edits use stable task IDs. Sharing only a plan between separate runs can reduce the investigation history carried into execution, but also makes the checklist responsible for preserving necessary context. These are architectural tradeoffs explained by the page; it supplies no comparative measurements.

Alternatives

Within Planning, the simplest documented configuration uses only write_plan and an in-memory store. Granular tools, dependencies and persistent stores add capabilities as needed. The page describes pydantic-ai-todo as a predecessor superseded by Planning and provides tool-name mappings for migration. It also contrasts its approach with repeatedly editing a plan in the system prompt. No broader comparison of planning libraries or agent frameworks is provided.

Evidence

The evidence is the complete documentation page at [https://pydantic.dev/docs/ai/harness/planning/index.md], captured on 15 November 2026. It contains explanatory text, configuration examples and an API reference. The linked implementation source at [https://github.com/pydantic/pydantic-ai/tree/main/src/pydantic_ai_harness/pydantic_ai_harness/planning/] was not examined. Behavioral statements therefore reflect documentation, with no execution results, benchmark data or independent verification.

Access & freshness

Costs

The page provides no library price, model rates, storage charges or measured savings, so total operating cost is unknown. Its caching rationale concerns preserving the prompt prefix rather than changing the system prompt on each plan edit. Caching must be enabled through model settings; Planning places no cache breakpoint itself. Full-plan tool results add conversation text, and every model request reads the store. The cost and latency effects of those operations are unmeasured.

Rights

The page links to implementation source but supplies no license text for the library, documentation or examples. Commercial-use, modification and redistribution permissions are unknown from this evidence. The linked repository and any separate license files are outside the documented scope.

Freshness

The capture date establishes when this copy was obtained, not its publication date or package release. The page warns that 0.x APIs may change between minor releases. It identifies cache_ttl as deprecated and ineffective, previous_state as a deprecated alias of previous_item, and older event-emitter interfaces as deprecated. It also records the tag change from <plan-reminder> to <plan_reminder>. Exact release applicability and compatibility with an installed environment are unknown.

Actions

Start with the smallest toolset that supports the intended workflow, then choose whether plans need to survive separate runs. Configure model caching explicitly if cache reuse matters. Before adopting persistent planning, verify store failure behavior, dependency transitions and plan restoration after compaction in the intended environment. For client-facing or durable applications, verify metadata retention and recovery with the actual adapter and engine. Confirm installation compatibility and license terms separately; none of these checks has been performed here.

Evidence for this report

selected-page.txtselected · checked 2026-11-15