-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Adding async support for tools #735
base: main
Are you sure you want to change the base?
Conversation
if is_async_tool: | ||
if tool.func: | ||
# async tool defined using BaseTool class from crewai_tools | ||
async_tool_run = tool._run | ||
elif tool.coroutine: | ||
# async tool defined using @tool decorator from langchain | ||
async_tool_run = tool._arun |
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.
Currently when we define an async function using @tool decorator or BaseTools, they get created differently.
For @tool decorator - if the function is a coroutine, func=None and the function gets added to the coroutine attribute.
However, for BaseTools, thats not the case, it remains part of the func attribute. To absorb this complexity from the user's perspective, we do it this way so that users can still define their async tools using _run when using BaseTools. There is no change from the user's perspective other than just adding a async while defining the tool.
This PR is stale because it has been open for 45 days with no activity. |
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for Async Tooling ImplementationOverviewThe pull request introduces asynchronous tool support in crewAI, specifically modifying Positive Aspects
Issues and Recommendations
Links to Related PRsWhile specific historical context cannot be provided, reviewing PRs that previously addressed error handling and async functionality can inform improvements in the current implementation. ConclusionThe changes in this pull request proficiently introduce async capabilities, but addressing suggested areas for improvement will further enhance code quality and maintainability. Streamlining the execution patterns, reinforcing error handling logic, and optimizing tests will make the project more robust and efficient. Thank you for the hard work put into this implementation! |
Hey @tg1482 , awesome job on the PR! Could you take a moment to check if the code you added is still relevant and working? We're here to help with anything you need to update and merge this addition. Thanks |
Following our discussion here, creating another PR with minimal changes to the codebase for supporting async tooling.
Previous PR here - #550
Added a test which passes for executing a pipeline with an async tool.