Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor clean up in preparation of graph agent #779

Merged
merged 3 commits into from
Jan 28, 2025

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Jan 26, 2025

  • Rename the (non-exported) RunResultData typevar to RunResultDataT for consistency with other typevars from Improve variance of classes #726
  • Define get_captured_run_messages function to access the private context var's data in another module (we will need access to this for that contextvar to work with GraphAgent. This change can be undone later; the function is not part of __all__.)
  • Change the return type of Tool.run from _messages.ModelRequestPart to the more specific _messages.ToolReturnPart | _messages.RetryPromptPart (no code changes necessary, just a more specific signature)
  • Add the node_span to the GraphRunContext

@dmontagu dmontagu force-pushed the dmontagu/graph-agent-prep branch from a064ead to fb95046 Compare January 26, 2025 18:04
Copy link

cloudflare-workers-and-pages bot commented Jan 26, 2025

Deploying pydantic-ai with  Cloudflare Pages  Cloudflare Pages

Latest commit: fbff76c
Status: ✅  Deploy successful!
Preview URL: https://2f5633e9.pydantic-ai.pages.dev
Branch Preview URL: https://dmontagu-graph-agent-prep.pydantic-ai.pages.dev

View logs

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one question.

Comment on lines +162 to 164
# TODO: Move this state off the Tool class, which is otherwise stateless.
# This should be tracked inside a specific agent run, not the tool.
current_retry: int = field(default=0, init=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created #784 to track this

pydantic_graph/pydantic_graph/nodes.py Outdated Show resolved Hide resolved
@sydney-runkle
Copy link
Member

Gemini is having live test issues.

@dmontagu dmontagu force-pushed the dmontagu/graph-agent-prep branch from 31bee5d to fbff76c Compare January 27, 2025 18:18
@dmontagu dmontagu merged commit ffd5691 into main Jan 28, 2025
15 checks passed
@dmontagu dmontagu deleted the dmontagu/graph-agent-prep branch January 28, 2025 16:44
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.

2 participants