-
Notifications
You must be signed in to change notification settings - Fork 22
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
Feature/contrib_crewai #166
Conversation
|
||
manager = CrewAIToolManager(arcade_client, user_id) | ||
# Retrieve the tools from the specified toolkit | ||
tools = manager.get_tools(toolkits=["google"]) |
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.
@lgesuellip @lpetralli Google calendar tools require authorization. I suspect you have already authorized Arcade for the google calendar tool with the cloud engine, so you likely did not run into this issue. You can use the arcade_client.tools.authorize
function to authorize a specific tool. See this example for authorizing a specific Google tool.
I also recommend running a local engine when developing so that authorizations are reset on each engine startup.
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.
Hey Eric, thank you for the feedback.
The tool includes logic to verify authentication, similar to the langgraph integration. If authentication is required but hasn’t been completed, it returns a link for the user to authenticate (
def create_tool_function(self, tool_name: str, **kwargs: Any) -> Callable[..., Any]: |
What do you think?
Would you recommend adding any extra logic to the example, such as waiting until the authorization process is completed?
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.
@EricGustin I wanted to check if you've had a chance to review it.
Thanks!
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.
Hey @lgesuellip , I'm running the example1 locally without prior Google authorization and it doesn't provide a link for me to authenticate. I believe the example itself needs to check if the tool returned an auth link, and then provide that link to the user before trying again.
Here's the full output:
~/r/Team/arcade-ai/ex/c/1. tool-example old *81 !2 ?5 ❯ python agent_crewai.py old 18:09:14
INFO:httpx:HTTP Request: GET http://localhost:9099/v1/tools/list?toolkit=google "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET http://localhost:9099/v1/tools/list?toolkit=google "HTTP/1.1 200 OK"
INFO:__main__:Starting the CrewAI agent workflow.
# Agent: Main Agent
## Task:
# Task
You are an AI assistant designed to help the team.
# Guidelines
Your responses should be:
- Friendly and approachable, using a warm tone
# User Request
Complete the following request using the tools at your disposal: Please schedule a calendar event for tomorrow from 10:00 PM to 11:00 PM Argentina time. The event is a meeting combined with team building activities.
18:09:18 - LiteLLM:INFO: utils.py:2765 -
LiteLLM completion() model= gpt-4o; provider = openai
INFO:LiteLLM:
LiteLLM completion() model= gpt-4o; provider = openai
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
18:09:19 - LiteLLM:INFO: utils.py:894 - Wrapper: Completed Call, calling success_handler
INFO:LiteLLM:Wrapper: Completed Call, calling success_handler
18:09:19 - LiteLLM:INFO: utils.py:2765 -
LiteLLM completion() model= gpt-4o; provider = openai
INFO:LiteLLM:
LiteLLM completion() model= gpt-4o; provider = openai
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
18:09:21 - LiteLLM:INFO: utils.py:894 - Wrapper: Completed Call, calling success_handler
INFO:LiteLLM:Wrapper: Completed Call, calling success_handler
# Agent: Main Agent
## Thought: Thought: To schedule the calendar event at the correct time, I need to adjust the time to match Argentina time, which is UTC-3. Therefore, the event should be scheduled from 10:00 PM to 11:00 PM UTC-3 tomorrow. I will proceed to create the event.
## Using tool: Google_CreateEvent
## Tool Input:
"{\"summary\": \"Meeting with Team Building Activities\", \"start_datetime\": \"2023-11-28T22:00:00-03:00\", \"end_datetime\": \"2023-11-28T23:00:00-03:00\", \"calendar_id\": \"primary\", \"description\": \"A meeting combined with team building activities.\", \"location\": \"\", \"visibility\": \"default\", \"attendee_emails\": []}"
## Tool Output:
Authorization required for Google_CreateEvent.
18:09:21 - LiteLLM:INFO: utils.py:2765 -
LiteLLM completion() model= gpt-4o; provider = openai
INFO:LiteLLM:
LiteLLM completion() model= gpt-4o; provider = openai
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
18:09:22 - LiteLLM:INFO: utils.py:894 - Wrapper: Completed Call, calling success_handler
INFO:LiteLLM:Wrapper: Completed Call, calling success_handler
# Agent: Main Agent
## Final Answer:
It looks like I encountered an issue while trying to schedule the event in your calendar. However, you can easily create this event in your calendar application by setting the details as follows:
Tomorrow, from 10:00 PM to 11:00 PM Argentina time, schedule a meeting combined with team-building activities. You can add this to your calendar and include any additional details or invite team members as needed.
If you have any questions or need further assistance, feel free to ask! 😊
INFO:__main__:Workflow executed: It looks like I encountered an issue while trying to schedule the event in your calendar. However, you can easily create this event in your calendar application by setting the details as follows:
Tomorrow, from 10:00 PM to 11:00 PM Argentina time, schedule a meeting combined with team-building activities. You can add this to your calendar and include any additional details or invite team members as needed.
If you have any questions or need further assistance, feel free to ask! 😊
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.
Hey Eric,
I just added a custom wait_for_completion
method for authorization handling (avoiding infinite loops):
- Introduced a new wait_for_completion method in ArcadeAuthMixin to manage the authorization process with a timeout.
- Updated CrewAIToolManager to use the new method for handling authorization status.
- Enhanced test cases in test_manager.py to mock and verify the behavior of the new authorization waiting logic.
Let me know what you think!
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.
Thanks @lgesuellip ! I left some comments inline.
Additionally, adding an empty py.typed
file in contrib/common
will get rid of 'no Any import' linting issues that I was running into.
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.
it would be really cool if this example played the recommended song by using the Arcade tool Spotify.StartTracksPlaybackById or Spotify.PlayTrackByName
@EricGustin thank you so much for all the suggestions, I just pushed them! |
Hey Team, are we good to merge the PR? |
Closing in favor of #253 |
ArcadeAI Integration with CrewAI
Hi team,
Here are all the details of this pull request that include the integration with CrewAI.
Contributions in
/contrib
Folder1. Generic ArcadeManager
ArcadeManager
to reduce code duplication across different integrations, such as LangChain and CrewAI.2. CrewAI Integration
StructuredTool
implementation, we developed one in this integration and submitted an issue and pull request to the CrewAI repository to include this feature natively in the future. (I am in conversation with the team, so I will give you updates regarding this part).CrewAIManager
class that inherits fromArcadeManager
. This ensures code reuse and leverages the generic manager while adding logic specific to CrewAI tools.3. Documentation and Testing
ArcadeManager
,CrewAIManager
, and related integrations.Examples in
/examples
Folder1. How to Use ArcadeAI Tools in CrewAI
2. ArcadeAI Authorization for CrewAI Tools
3. End-to-End Example
Thank you Team,
Looking forward to your feedback!