fix(agents): await native async tools on caller loop#6616
fix(agents): await native async tools on caller loop#6616Sakshamm-Goyal wants to merge 1 commit into
Conversation
|
This PR was authored with AI assistance. The repository contribution policy requires the |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe experimental ChangesAsync native tool execution
Sequence Diagram(s)sequenceDiagram
participant Flow
participant AgentExecutor
participant WorkerThread
participant BaseTool
participant EventLoop
Flow->>AgentExecutor: execute_native_tool_async()
AgentExecutor->>EventLoop: capture running loop
AgentExecutor->>WorkerThread: execute_native_tool()
WorkerThread->>BaseTool: _run_native_tool()
BaseTool-->>EventLoop: schedule awaitable result
EventLoop-->>AgentExecutor: return tool result
AgentExecutor-->>Flow: native tool completion
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
BaseTool._run, wrapped async functions, parallel calls, and flow-route registrationCloses #6611
Validation
pytest lib/crewai/tests/agents/test_agent_executor.py -q -n 0 --timeout=60 --block-network --import-mode=importlib -k "not anthropic_provider_has_image_block_converter and not kickoff_response_format_with_planning_and_tools"(98 passed, 2 deselected because optional Anthropic/Exa dependencies are unavailable)pytest lib/crewai/tests/agents/test_agent_executor.py::TestNativeToolExecution -q -n 0 --timeout=60 --block-network --import-mode=importlib(8 passed)mypy lib/crewai/src/crewai/experimental/agent_executor.pyruff checkandruff format --checkon changed files