Skip to content

feat: NativeToolCallEngine — provider-native tool-calling loop#5

Open
JarbasAl wants to merge 2 commits into
devfrom
feat/native-toolcall-loop
Open

feat: NativeToolCallEngine — provider-native tool-calling loop#5
JarbasAl wants to merge 2 commits into
devfrom
feat/native-toolcall-loop

Conversation

@JarbasAl

Copy link
Copy Markdown
Member

Adds an agent-loop ChatEngine that drives tools via the brain's native function-calling instead of ReAct's text protocol.

What it does

  • NativeToolCallEngine passes the ToolBox objects to brain.continue_chat(tools=...), reads structured AgentMessage.tool_calls back, executes each via the existing ToolBox machinery, and feeds results back as MessageRole.TOOL messages until the brain answers without requesting a tool.
  • Subclasses ReActLoopEngine (reusing brain wiring / toolbox loading / _call_tool) and falls back to the ReAct text loop when the brain lacks supports_tools — so it works with any brain, using the better path when available.
  • Registered as opm.agents.chat entry point ovos-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 to loop-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 via pre_install_pip until it releases.

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@JarbasAl, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 95115c4d-f272-4d6d-9f80-dfc5db4bdf9c

📥 Commits

Reviewing files that changed from the base of the PR and between b08d677 and 0f9a38f.

📒 Files selected for processing (12)
  • .github/workflows/build-tests.yml
  • .github/workflows/coverage.yml
  • docs/index.md
  • docs/loop-architectures.md
  • docs/native-toolcall-loop.md
  • examples/native_toolcall_persona.json
  • examples/native_toolcall_persona.py
  • ovos_agentic_loop/factory.py
  • ovos_agentic_loop/native_toolcall.py
  • pyproject.toml
  • test/test_native_toolcall.py
  • test/test_native_toolcall_e2e.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/native-toolcall-loop

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Greetings, human! The automated checks are complete. 👾

I've aggregated the results of the automated checks for this PR below.

🔍 Lint

The latest findings are now at your fingertips. ⌨️

ruff: issues found — see job log

🏷️ Release Preview

The release notes are being translated as we speak. 🌍

Current: 0.1.1a1Next: 0.2.0a1

Signal Value
Label feature
PR title feat: NativeToolCallEngine — provider-native tool-calling loop
Bump minor

✅ PR title follows conventional commit format.


🚀 Release Channel Compatibility

Predicted next version: 0.2.0a1

Channel Status Note Current Constraint
Stable Not in channel -
Testing Not in channel -
Alpha Compatible ovos-agentic-loop>=0.1.1a1

🔌 Plugin Detection

Checking if the plugin's 'handshake' with the manager is firm. 🤝

⚠️ Plugin Status: WARNINGS (2)

Plugin Info:

  • Name: ovos-agentic-loop
  • Description: AgenticLoopEngine base and ReAct implementation for OVOS, with SKILL.md and AGENTS.md runtime consumption

Plugin Types: agents.chat, agents.toolbox, agents.memory

OPM Detection:

Plugin Type Wheel Editable
agents.chat
agents.memory
agents.toolbox

Entry Point Validation:

Entry Point Type Import Interface
ovos-agents-md-context-plugin agents.memory
ovos-chain-of-thought-loop agents.chat
ovos-clock-tools agents.toolbox
ovos-critic-loop agents.chat
ovos-filesystem-tools agents.toolbox ✅ 34ms
ovos-math-tools agents.toolbox
ovos-native-toolcall-loop agents.chat
ovos-plan-execute-loop agents.chat
ovos-react-loop agents.chat ✅ 11ms
ovos-reflexion-loop agents.chat
ovos-self-ask-loop agents.chat
ovos-shell-tools agents.toolbox
ovos-skill-md-toolbox agents.toolbox ✅ 100ms
ovos-tree-of-thoughts-loop agents.chat
ovos-web-search-tools agents.toolbox

⊘ No settingsmeta.json
requires-python >=3.10 — running Python 3.11

Issues:

  • ⚠️ No settingsmeta.json found
  • ⚠️ No settingsmeta.json found

⚖️ License Check

Ensuring 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.

📊 Coverage

Measuring the footprint of your testing efforts. 👣

94.3% total coverage

Full report: download the coverage-report artifact.

📋 Repo Health

Scanning for any signs of 'dependency' parasites. 🐛

⚠️ Some required files are missing.

Latest Version: 0.1.1a1

ovos_agentic_loop/version.py — Version file
README.md — README
LICENSE — License file
pyproject.toml — pyproject.toml
⚠️ setup.py — setup.py
CHANGELOG.md — Changelog
ovos_agentic_loop/version.py has valid version block markers

🔒 Security (pip-audit)

A detailed security audit of your contribution. 📝

✅ No known vulnerabilities found (65 packages scanned).

🔨 Build Tests

The build is complete. No hard hats required. 👷‍♂️

✅ All versions pass

Python Build Install Tests
3.10
3.11
3.12
3.13
3.14

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant