Skip to content

fix(tutorials): repair five tutorials that fail with a real model - #546

Merged
danielmillerp merged 9 commits into
mainfrom
dm/pin-pydantic-state-machine-mcp
Oct 9, 2026
Merged

danielmillerp merged 9 commits into
mainfrom
dm/pin-pydantic-state-machine-mcp

Conversation

@danielmillerp

@danielmillerp danielmillerp commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What this fixes

Five tutorials fail or flake against a real model. Three have MCP servers that die at startup, and two have agents that sometimes answer without calling their tool:

Tutorial Cause Fix
10_async/10_temporal/020_state_machine pydantic 2.14 break (below) add --with pydantic<2.14 to the existing uvx pin
10_async/10_temporal/010_agent_chat same same pin on its uvx openai-websearch-mcp
10_async/00_base/040_other_sdks same, plus its image has no Node, so npx for the sequential-thinking server raises FileNotFoundError: 'npx' same pin, and install nodejs npm in its Dockerfile
10_async/10_temporal/110_pydantic_ai, 10_async/00_base/110_pydantic_ai the prompt says to "use tools when they would help", so gpt-4o-mini sometimes answers a weather question without calling get_weather (seen failing all 3 attempts in one run) add a guideline: when asked for the current weather in a place, call get_weather and never answer from memory. The test is unchanged.

The pydantic break. openai-websearch-mcp pins mcp==1.13.1, which imports eval_type_backport from pydantic's internals. pydantic 2.14.0, released 2026-10-08, removed it. uvx resolves each server unpinned, so it picks up 2.14.0 and the server dies at import:

ImportError: cannot import name 'eval_type_backport' from 'pydantic._internal._typing_extra'

The agent's MCP context then fails with Connection closed before the model runs, and the tests report "Did not use tool requests" or time out.

Verification

  • uvx --with "mcp<2" openai-websearch-mcp: exits 1 with the ImportError above (pydantic 2.14.0).
  • With --with "pydantic<2.14" added: starts and exits cleanly (exit 0). mcp-server-time and mcp-server-fetch with the same pin also exit 0.
  • npx -y @modelcontextprotocol/server-sequential-thinking starts ("running on stdio") once Node is installed.
  • All three tutorials failed the same way on agentex main with a model key, so this isn't a server regression.

The tutorial images need to be republished after merge for the agentex integration tests to pick them up.

🤖 Generated with Claude Code

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the earlier weather-tool concern has been addressed.

Summary

The PR updates three tutorials so their MCP servers use a compatible Pydantic version, adds Node and npm to an image that runs an npx server, and tells two weather agents to call get_weather.

  • MCP servers stay on a Pydantic version their web-search tool supports.
  • The 040_other_sdks tutorial image can run its npx server.
  • Weather questions tell both Pydantic AI agents to call get_weather.

Reviews (5) · Last reviewed commit: "fix(tutorials): limit the get_weather in..." · Reviewed by Greptile

danielmillerp and others added 4 commits October 8, 2026 17:02
openai-websearch-mcp pins mcp 1.13.1, which imports a private pydantic
helper that pydantic 2.14 removed. uvx resolves each server unpinned, so
the server died at import and the agent made no tool calls. Add
pydantic<2.14 to the existing uvx pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…CP server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danielmillerp danielmillerp changed the title fix(tutorials): cap pydantic for the state machine MCP servers fix(tutorials): repair the MCP servers in three tutorials Oct 8, 2026
danielmillerp and others added 2 commits October 8, 2026 19:49
…gent

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danielmillerp danielmillerp changed the title fix(tutorials): repair the MCP servers in three tutorials fix(tutorials): repair five tutorials that fail with a real model Oct 8, 2026
Comment thread examples/tutorials/10_async/10_temporal/110_pydantic_ai/project/agent.py Outdated
danielmillerp and others added 3 commits October 8, 2026 19:53
The instruction sent every weather question to get_weather, including
ones the tool can't answer (for example, what causes rain), which in the
Temporal tutorial also runs an extra activity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…questions (Temporal)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…questions (base)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danielmillerp
danielmillerp merged commit 85b0342 into main Oct 9, 2026
65 of 66 checks passed
@danielmillerp
danielmillerp deleted the dm/pin-pydantic-state-machine-mcp branch October 9, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant