Skip to content

Conversation

@zzstoatzz
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 7, 2025 15:25
Copy link
Contributor

Copilot AI left a 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 in wrap.py
  • Revamp progress message formatting to include a summary of tool counts
  • Initialize and reset the tool-usage context in run_agent (in api.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:
Copy link

Copilot AI Jul 7, 2025

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.

Suggested change
if _progress:
if _progress and _current_tool_token is not None:

Copilot uses AI. Check for mistakes.

return result
finally:
if _progress:
Copy link

Copilot AI Jul 7, 2025

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.

Suggested change
if _progress:
if _current_tool_token is not None: # Reset unconditionally if token is set

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Jul 7, 2025

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.

Suggested change
- **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 uses AI. Check for mistakes.
@zzstoatzz zzstoatzz merged commit 6fdd37c into main Jul 7, 2025
3 checks passed
@zzstoatzz zzstoatzz deleted the slackbot-improvements branch July 7, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants