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

fix: Allow manual execute action for any action #1147

Merged
merged 4 commits into from
Jan 3, 2025

Conversation

tushar-composio
Copy link
Contributor

@tushar-composio tushar-composio commented Jan 3, 2025

In the last release, we started blocking ALL execute_action calls on toolsets that used get_tools() to request tools. This chanage avoids blocking manually made execute_action calls.


Important

Introduces _check_requested_actions flag in toolset.py to allow manual execute_action calls without checks, updating related files and tests.

  • Behavior:
    • Introduces _check_requested_actions flag in execute_action() in toolset.py to allow manual calls without checks.
    • Updates execute_action() calls in composio_autogen/toolset.py, composio_camel/toolset.py, and 10 other files to set _check_requested_actions=True.
  • Initialization:
    • Initializes _requested_actions as an empty list in toolset.py.
  • Tests:
    • Updates test_invalid_handle_tool_calls() in test_toolset.py to test manual execute_action() calls without _check_requested_actions flag.

This description was created by Ellipsis for 58b6e38. It will automatically update as commits are pushed.

Copy link

vercel bot commented Jan 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 8:11am

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 598e7e5 in 24 seconds

More details
  • Looked at 226 lines of code in 14 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. python/composio/tools/toolset.py:331
  • Draft comment:
    The change from None to an empty list [] for _requested_actions ensures that the list is always initialized, preventing potential NoneType errors. This aligns with the new logic where _check_requested_actions is used to control action execution checks.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The change from self._requested_actions being None to an empty list [] in the constructor of ComposioToolSet is a significant change. This change affects the logic in execute_action where _check_requested_actions is used. The previous logic checked if self._requested_actions was None to bypass the check, but now it relies on the _check_requested_actions flag. This change is intentional and aligns with the PR's goal to allow manual execution of actions without prior requests. The test test_invalid_handle_tool_calls has been updated to reflect this change, ensuring that the _check_requested_actions flag is respected. This change is consistent across the codebase, as seen in the various toolset implementations where _check_requested_actions=True is passed. The change is well-covered by tests, ensuring that the new behavior is correctly implemented.
2. python/composio/tools/toolset.py:851
  • Draft comment:
    The _check_requested_actions parameter allows for conditional checking of requested actions, providing flexibility in action execution.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The addition of the _check_requested_actions parameter in the execute_action method allows for more flexible control over whether actions need to be pre-requested. This change is consistent with the PR's intent to allow manual execution of actions without prior requests. The default value is set to False, which means that by default, actions do not need to be pre-requested unless explicitly specified. This change is reflected in the test cases and other parts of the codebase where _check_requested_actions=True is passed to enforce the check.

Workflow ID: wflow_q7hZatwOXxsn6vn8


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

Walkthrough

This update enhances the toolset by introducing a new parameter _check_requested_actions to the execute_action method, allowing for manual execution of actions without prior requests. This change improves flexibility across various plugins by ensuring actions are validated only when necessary. Additionally, a new test case has been added to verify the behavior of this feature, ensuring robustness and reliability in handling tool calls.

Changes

File(s) Summary
python/composio/tools/toolset.py Modified execute_action to include _check_requested_actions parameter, allowing manual execution of actions. Initialized _requested_actions as an empty list.
python/plugins/*/toolset.py Added _check_requested_actions=True to various methods across plugins for action validation.
python/tests/test_tools/test_toolset.py Added test cases to verify _check_requested_actions behavior, ensuring correct error handling and validation.

🔗 Related PRs

Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts below

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @bot + *your message*
Example: @bot Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @bot + *feedback*
Example: @bot Do not comment on `save_auth` function !

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on cc1515c in 48 seconds

More details
  • Looked at 47 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. python/plugins/google/composio_google/toolset.py:163
  • Draft comment:
    Typo in parameter name '_poplate_requested'. It should be '_populate_requested'. This typo appears in multiple files.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_nHJG3KVB6mxMD0nC


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

python/plugins/autogen/composio_autogen/toolset.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 58b6e38 in 32 seconds

More details
  • Looked at 30 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. python/plugins/autogen/composio_autogen/toolset.py:50
  • Draft comment:
    Typo in parameter name _poplate_requested. It should be _populate_requested.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
2. python/plugins/google/composio_google/toolset.py:166
  • Draft comment:
    Typo in parameter name _poplate_requested. It should be _populate_requested.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_KnBrFXRfi2gr6KwK


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@tushar-composio tushar-composio merged commit 216c98d into master Jan 3, 2025
22 of 23 checks passed
@tushar-composio tushar-composio deleted the fix-manual-execute-action branch January 3, 2025 08:25
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