One release changes execution and tool discovery
Pydantic AI’s v2.63.0 release added IPythonCodeMode, giving Harness agents access to full CPython and installed packages. Published October 28, 2026, it also made Monty CodeMode’s dynamic tool catalog the default. The changes serve separate needs: running package-dependent Python and preserving a stable prompt prefix as tools appear. Sources: Pydantic on GitHub, Pydantic
The release title carries October 27, 2026, while GitHub’s publication line shows October 28 at 00:55. The capabilities belong to Pydantic AI Harness, which remains on a 0.x version line. The catalog pull request cites that versioning context when explaining why a minor release can include this compatibility change. Developers should distinguish the repository’s release number from the versions of individual packages. Sources: Pydantic on GitHub
Compare the same sales calculation
Start with a controlled sales-analysis fixture: a single tool returning monthly revenue in integer cents for North and South. Each region’s response contains January followed by February. Ask the agent to compare January-to-February growth and retain the loaded data. It should return growth percentages and the winning region, or an explicit tie. Keep the model, instructions, tool implementation, and data constant. Request another calculation within the run, then repeat across a new run to separate those two persistence requirements.
The implementation provides separate capabilities through a common run_code interface. The setup below switches the capability while keeping the agent construction the same. Use it as the starting point for a comparison with the same model and task. Sources: Pydantic on GitHub
from pydantic_ai import Agent
from pydantic_ai_harness import CodeMode, IPythonCodeMode
capability = CodeMode() # Monty arm
# capability = IPythonCodeMode() # IPython arm
agent = Agent(model, capabilities=[capability])IPython exposes registered tools as synchronous functions, while Monty exposes asynchronous functions. The illustrative cells below perform the same arithmetic through those interfaces, with IPython first. The IPython example loads results into pandas DataFrames, although this small calculation does not require pandas. Package access becomes more useful when the task expands into joins, statistical routines, or plotting. Sources: Pydantic
import pandas as pd
north = pd.DataFrame(get_sales(region="north"))
south = pd.DataFrame(get_sales(region="south"))
growth = {
"north": (north["revenue_cents"].iloc[1]
/ north["revenue_cents"].iloc[0] - 1) * 100,
"south": (south["revenue_cents"].iloc[1]
/ south["revenue_cents"].iloc[0] - 1) * 100,
}
if growth["north"] == growth["south"]:
winner = "tie"
elif growth["north"] > growth["south"]:
winner = "north"
else:
winner = "south"
{"growth_percent": growth, "winner": winner}north = await get_sales(region="north")
south = await get_sales(region="south")
growth = {
"north": (north[1]["revenue_cents"] / north[0]["revenue_cents"] - 1) * 100,
"south": (south[1]["revenue_cents"] / south[0]["revenue_cents"] - 1) * 100,
}
if growth["north"] == growth["south"]:
winner = "tie"
elif growth["north"] > growth["south"]:
winner = "north"
else:
winner = "south"
{"growth_percent": growth, "winner": winner}Package access brings host permissions
IPythonCodeMode runs CPython in a separate kernel process and can use installed packages. Its installation extra includes ipykernel and jupyter-client without requiring Monty. Registered tool calls still pass through argument validation, hooks, approval handlers, and usage accounting. Those controls govern registered calls; they do not make the kernel a permissions sandbox. Sources: Pydantic on GitHub, Pydantic
Pydantic’s documentation says IPython has the user’s filesystem, network, environment, and process permissions. Monty describes its protection as language-level isolation, rather than a container, virtual machine, or seccomp boundary. Without configured host functions or mounts, generated code cannot access files, environment variables, sockets, or processes. The table below separates these access rules from scheduling and integration support. Sources: Pydantic, Pydantic on GitHub
Table
Execution and integration differences
| Attribute | Monty CodeMode | IPythonCodeMode |
|---|---|---|
| Python environment | Restricted implementation | Full CPython and installed packages |
| Host access | Explicit grants through host functions or mounts | User’s filesystem, network, environment, and process permissions |
| Tool scheduling | Async functions; supports asyncio.gather | Synchronous, sequential calls |
| Cross-run state | Stored interpreter dump through repl_store | Live namespace through explicit IPythonKernel |
| Durable execution | Supported integrations | Unsupported |
| Dynamic catalog | Supported and now default | Unsupported |
Monty supports functions, comprehensions, exceptions, simple classes, and asynchronous constructs, but its limitations include inheritance and generator functions. Its map, filter, and zip operations evaluate eagerly, and generator expressions produce lists. These differences matter when assessing memory use for larger sales datasets. Test the actual transformations before assuming familiar Python syntax produces the same behavior. Sources: Pydantic
Retained variables have different lifecycles
Monty retains variables, imports, and functions between run_code calls within a run. Cross-run persistence requires repl_store, whose asynchronous load and save operations store an opaque interpreter dump under a conversation key. Incompatible versions or resource limits can cause restoration to be discarded. Dumps require trusted storage because they are unauthenticated, and the store is not used during durable execution. Sources: Pydantic
IPython starts its kernel lazily and normally shuts it down when the run ends. An explicit IPythonKernel preserves its live namespace across runs, leaves cleanup to the application, and serializes cells sharing that kernel. Its default timeout is 60 seconds, excluding tool-call time. An interrupt normally preserves state, but failure to stop within another five seconds shuts down the kernel. The next call receives a fresh kernel; output is capped at 10 MiB. Sources: Pydantic
Pydantic’s benchmark article describes Monty defaults of 30 seconds of execution and a 256 MiB heap. Monty pauses execution budgets while awaiting host operations and applies separate compilation constraints. These limits are not directly comparable with IPython’s deadline. For the sales fixture, check whether loaded data survives another cell, another agent run, and a timeout or process crash. Conversation history alone does not prove that executable state survived. Sources: Pydantic
Tool discovery changes prompt caching
Extend the fixture with a deferred sales-target tool and ask the agent to discover it after calculating growth. Under Monty’s new default, discovered function definitions accumulate in an instruction block instead of repeatedly rewriting run_code’s description. Deferred tools managed by run_code use local search_tools, and disabling the dynamic catalog restores the previous behavior. Another instruction-contributing toolset with the identifier code_mode now causes a duplicate-ID error. Sources: Pydantic on GitHub
IPython keeps signatures in its tool description as its toolset changes and does not support the dynamic catalog. A persistent kernel therefore does not provide Monty’s cache-preserving discovery mechanism. The catalog pull request reports 480 runs across 10 tasks, two modes, six models, and four repetitions. It reports Opus input falling from 18.6k to 12.4k tokens per run, with approximately 70% less uncached input. OpenAI and Gemini results were reported as neutral. Sources: Pydantic, Pydantic on GitHub
Those maintainer measurements compare catalog modes, not IPython with Monty. Pydantic’s separate 5,276-run benchmark compared Monty with ordinary tool calling on version 2.56.1.dev13; its benchmark code is not public. It reported 58% lower long-task costs, but three of five scaling tasks cost 21–38% more with code mode at five items. Neither comparison establishes which runtime is faster for pandas analysis. Treat the sales fixture as a proposed test, not a measured result, and measure caching under the intended provider and discovery pattern. Sources: Pydantic on GitHub, Pydantic
Choose by required access, then measure
For the initial arithmetic workload, Monty is a reasonable starting point when generated code should receive only explicitly granted access. Its asynchronous tool interface supports asyncio.gather, while IPython tool calls run sequentially. IPython is the stronger candidate when the job depends on installed packages and the deployment can accommodate its host permissions. Establish those requirements before comparing speed. Sources: Pydantic, Pydantic on GitHub
Evaluate the small arithmetic workload first, then add pandas and plotting as a separate workload. Pin package versions and record correctness, cold and warm latency, peak memory, state retention, timeout recovery, and cache tokens during tool discovery. Repeat runs to distinguish consistent behavior from individual outcomes. For applications retaining kernels or restoring dumps, define how lost state is detected and sales data is reloaded before another calculation is accepted.