feat: NativeToolCallEngine — provider-native tool-calling loop#5
feat: NativeToolCallEngine — provider-native tool-calling loop#5JarbasAl wants to merge 2 commits into
Conversation
Add an agent loop that uses the brain's native function-calling: it passes the ToolBox objects to continue_chat(tools=...), reads structured AgentMessage.tool_calls back, executes them via the existing ToolBox machinery, and feeds results back as MessageRole.TOOL messages until the brain answers. Subclasses ReActLoopEngine and falls back to the ReAct text loop when the brain lacks supports_tools, so it works with any brain. Registered as opm.agents.chat entry point ovos-native-toolcall-loop. Tests, docs (native-toolcall-loop.md + loop-architectures/index), and an example. CI installs the ovos-plugin-manager tool-calling branch until it releases. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 17 minutes and 26 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ 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 |
Greetings, human! The automated checks are complete. 👾I've aggregated the results of the automated checks for this PR below. 🔍 LintThe latest findings are now at your fingertips. ⌨️ ❌ ruff: issues found — see job log 🏷️ Release PreviewThe release notes are being translated as we speak. 🌍 Current:
✅ PR title follows conventional commit format. 🚀 Release Channel Compatibility Predicted next version:
🔌 Plugin DetectionChecking if the plugin's 'handshake' with the manager is firm. 🤝 Plugin Info:
Plugin Types: agents.chat, agents.toolbox, agents.memory OPM Detection:
Entry Point Validation:
⊘ No Issues:
⚖️ License CheckEnsuring our licenses are consistent and clear. 📄 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 📊 CoverageMeasuring the footprint of your testing efforts. 👣 ✅ 94.3% total coverage Full report: download the 📋 Repo HealthScanning for any signs of 'dependency' parasites. 🐛 Latest Version: ✅ 🔒 Security (pip-audit)A detailed security audit of your contribution. 📝 ✅ No known vulnerabilities found (65 packages scanned). 🔨 Build TestsThe build is complete. No hard hats required. 👷♂️ ✅ All versions pass
Your loyal automated servant. 💂♀️ |
Add test_native_toolcall_e2e: drives NativeToolCallEngine with a real OpenAIChatEngine brain (HTTP mocked) and the real MathToolBox, asserting a full tool round-trip where evaluate_expression actually computes 12*9=108 and the result is serialized back as a TOOL message. Only the LLM HTTP is mocked. Adds ovos-openai-plugin as a test brain (CI installs the opm-agents branch). Also fixes the example: MathToolBox() takes no toolbox_id. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds an agent-loop
ChatEnginethat drives tools via the brain's native function-calling instead of ReAct's text protocol.What it does
NativeToolCallEnginepasses theToolBoxobjects tobrain.continue_chat(tools=...), reads structuredAgentMessage.tool_callsback, executes each via the existingToolBoxmachinery, and feeds results back asMessageRole.TOOLmessages until the brain answers without requesting a tool.ReActLoopEngine(reusing brain wiring / toolbox loading /_call_tool) and falls back to the ReAct text loop when the brain lackssupports_tools— so it works with any brain, using the better path when available.opm.agents.chatentry pointovos-native-toolcall-loop.Why
Native function-calling is more reliable and cheaper than regex-parsing ReAct text when the provider supports it.
Includes tests (
test/test_native_toolcall.py), a deep-dive doc, updates toloop-architectures.md/index.md, and an example pair.Depends on the tool-calling contract in ovos-plugin-manager#403 (
MessageRole.TOOL,ToolCall,tools=,supports_tools,ToolBox.normalize_tools); CI installs that branch viapre_install_pipuntil it releases.🤖 Generated with Claude Code