-
Notifications
You must be signed in to change notification settings - Fork 521
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
Add GraphRun object to make use of next
more ergonomic
#833
Merged
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
57905c0
Add GraphRun class
dmontagu 1a09378
Minor improvements
dmontagu 0c3b48d
Move definition of MarkFinalResult to result module
dmontagu 9280adf
A bit more clean-up
dmontagu 7d55afd
Update call_id logic
dmontagu 63df8ba
Minor fixes
dmontagu 6c65095
Update some things
dmontagu db56e31
Update some comments etc.
dmontagu 9af98e8
Undo kind changes
dmontagu 2100a1a
Merge branch 'main' into dmontagu/graph-run-object
dmontagu 78e85d6
Introduce auxiliary types
dmontagu e0c716b
Merge main
dmontagu ef8895a
Address some feedback
dmontagu 13e3b86
result -> node
dmontagu a08aafa
Rename MarkFinalResult to FinalResult
dmontagu ff6f699
Remove GraphRunner/AgentRunner and add .iter() API
dmontagu 41bb069
Make result private
dmontagu b565088
Reduce diff to main and add some docstrings
dmontagu 8d2c74e
Add more docstrings
dmontagu 4bb67a5
Add more docs
dmontagu a6e6445
Fix various docs references
dmontagu 007d8ca
Fix final docs references
dmontagu 6d532c1
Address some feedback
dmontagu 0745ba9
Update docs
dmontagu 8d86b3a
Fix docs build
dmontagu bdb5f77
Make the graph_run_result private on AgentRunResult
dmontagu 0d36dbf
Some minor cleanup of reprs
dmontagu aa8b36a
Merge branch 'main' into dmontagu/graph-run-object
dmontagu 9a676d2
Tweak some APIs
dmontagu e799024
Rename final_result to result and drop DepsT in some places
dmontagu c7ab89f
More cleanup
dmontagu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ | |
result, | ||
usage as _usage, | ||
) | ||
from ._agent_graph import EndStrategy, capture_run_messages # imported for re-export | ||
from .result import FinalResult, ResultDataT, StreamedRunResult | ||
from .settings import ModelSettings, merge_model_settings | ||
from .tools import ( | ||
|
@@ -40,7 +39,24 @@ | |
ToolPrepareFunc, | ||
) | ||
|
||
__all__ = 'Agent', 'AgentRun', 'AgentRunResult', 'capture_run_messages', 'EndStrategy' | ||
# Re-exporting like this improves auto-import behavior in PyCharm | ||
capture_run_messages = _agent_graph.capture_run_messages | ||
EndStrategy = _agent_graph.EndStrategy | ||
HandleResponseNode = _agent_graph.HandleResponseNode | ||
ModelRequestNode = _agent_graph.ModelRequestNode | ||
UserPromptNode = _agent_graph.UserPromptNode | ||
Comment on lines
+42
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @samuelcolvin let me know if you think there's a better way to do this. (I tried other things I could think of and this worked best.) |
||
|
||
|
||
__all__ = ( | ||
'Agent', | ||
'AgentRun', | ||
'AgentRunResult', | ||
'capture_run_messages', | ||
'EndStrategy', | ||
'HandleResponseNode', | ||
'ModelRequestNode', | ||
'UserPromptNode', | ||
) | ||
|
||
_logfire = logfire_api.Logfire(otel_scope='pydantic-ai') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be public since the nodes you get from iterating are now kind of public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's enough to leave the module private and re-export the node classes, but I'm also okay to make the module public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've done the re-export thing now, and it works for me in pycharm, but it might be worth double-checking on your end