-
Notifications
You must be signed in to change notification settings - Fork 389
minor slackbot improvements #1177
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
Conversation
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.
Pull Request Overview
This PR enhances the Slackbot’s progress reporting by tracking and displaying how many times each tool is used, and ensures counts are initialized and cleared per agent run.
- Introduce
ContextVars to track tool usage and current tool inwrap.py - Revamp progress message formatting to include a summary of tool counts
- Initialize and reset the tool-usage context in
run_agent(inapi.py) - Clarify version-defaulting rules in
research_agent.py
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| examples/slackbot/src/slackbot/wrap.py | Added ContextVars for usage counts/current tool and updated progress formatting |
| examples/slackbot/src/slackbot/research_agent.py | Made Prefect-3.x default rule more prominent (but duplicated) |
| examples/slackbot/src/slackbot/api.py | Initialize and reset _tool_usage_counts around run_agent |
|
|
||
| return result | ||
| finally: | ||
| if _progress: |
Copilot
AI
Jul 7, 2025
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.
_current_tool_token may not be defined if an exception is raised before it's set, causing an UnboundLocalError. Consider defining a default token or guarding the reset to ensure the variable exists.
| if _progress: | |
| if _progress and _current_tool_token is not None: |
|
|
||
| return result | ||
| finally: | ||
| if _progress: |
Copilot
AI
Jul 7, 2025
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.
Resetting _current_tool only when _progress is truthy can leave the context var set in other cases, leaking state. The reset should be unconditional or independently guarded.
| if _progress: | |
| if _current_tool_token is not None: # Reset unconditionally if token is set |
| 6. Review gotchas and release notes for recent changes | ||
| CRITICAL VERSION-SPECIFIC RULES: | ||
| - **DEFAULT TO PREFECT 3.x**: Do NOT use search_prefect_2x_docs unless user explicitly mentions "2.x", "Prefect 2", or asks about version differences |
Copilot
AI
Jul 7, 2025
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.
[nitpick] This rule repeats the guidance already stated in item 5 above. Consider removing one of the duplicates to keep the documentation concise and avoid confusion.
| - **DEFAULT TO PREFECT 3.x**: Do NOT use search_prefect_2x_docs unless user explicitly mentions "2.x", "Prefect 2", or asks about version differences |
No description provided.