zeroclaw/src/agent
Vernon Stinebaker f322360248 feat(providers): add native tool-call API support via chat_with_tools
Add chat_with_tools() to the Provider trait with a default fallback to
chat_with_history(). Implement native tool calling in OpenRouterProvider,
reusing existing NativeChatRequest/NativeChatResponse structs. Wire the
agent loop to use native tool calls when the provider supports them,
falling back to XML-based parsing otherwise.

Changes are purely additive to traits.rs and openrouter.rs. The only
deletions (36 lines) are within run_tool_call_loop() in loop_.rs where
the LLM call section was replaced with a branching if/else for native
vs XML tool calling.

Includes 5 new tests covering:
- chat_with_tools error path (missing API key)
- NativeChatResponse deserialization (tool calls only, mixed)
- parse_native_response conversion to ChatResponse
- tools_to_openai_format schema validation
2026-02-17 17:55:38 +08:00
..
agent.rs feat: pass a cloned config to all_tools_with_runtime for improved tool initialization 2026-02-17 17:06:28 +08:00
dispatcher.rs feat: add agent structure and improve tooling for provider 2026-02-17 01:01:56 +08:00
loop_.rs feat(providers): add native tool-call API support via chat_with_tools 2026-02-17 17:55:38 +08:00
memory_loader.rs feat: add agent structure and improve tooling for provider 2026-02-17 01:01:56 +08:00
mod.rs refactor: improve code formatting and structure across multiple files 2026-02-17 01:01:56 +08:00
prompt.rs feat: add agent structure and improve tooling for provider 2026-02-17 01:01:56 +08:00