Skip to content

Control not being returned to the agent on ModelRetry exception in temporal worker #3298

@wreed4

Description

@wreed4

Initial Checks

Description

I'm testing out a simple temporal agent with a fetch MCP server. The agent attempted to fetch a webpage that doesn't exist, so it gets a 404. This is going to be fairly standard. The MCP server raises a ModelRetry exception, again fairly standard... but unfortunately, Temporal sees this as a failure of the activity and will now constantly retry this forever. ModelRetry exceptions should be considered non-retryable errors by default by Pydantic's Temporal agent.

Example Code

simply adding 


    toolsets=[
        MCPServerStdio(id="fetch", command="uvx", args=["mcp-server-fetch"])
    ],


to the agent in the example on the pydantic docs page https://ai.pydantic.dev/durable_execution/temporal/  you can reproduce this if you get it to hit a 404 page.

Python, Pydantic AI & LLM client version

python: 3.13.6
pydantic-ai: v1.8.0
LLM client: pydantic-ai-slim[openai] (open ai compatible custom API, using anthropic claude 3.7 as the model).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions