forked from molecule-ai/molecule-core
Instead of injecting tool definitions as text into the system prompt, HermesA2AExecutor now accepts a tools: list[dict] | None constructor parameter containing OpenAI-format tool definitions and forwards them via the native tools= parameter on chat.completions.create(). Empty list / None rule: when tools is falsy, the tools key is omitted from the API call entirely — never sent as tools=[] — so providers that reject an empty tools array don't return a 400. Tool-call response handling: when the model returns finish_reason "tool_calls" with no text content, the executor serialises the call list as a JSON string and enqueues it as the A2A reply. This keeps the executor thin (single API call per turn, no ReAct loop) while surfacing function-call intent in a structured, parseable format. Changes: - HermesA2AExecutor.__init__: new tools kwarg; stored as self._tools (copy; mutating the input list has no effect) - execute(): builds create_kwargs dict and conditionally adds tools= only when self._tools is non-empty; handles tool_calls response - Module docstring: new "Native tools (#497)" section with schema reference and edge-case explanation Tests (12 new, 47 total in hermes test file, 1002 total suite): - tools stored correctly in constructor (copy, None, [], non-empty) - non-empty tools forwarded as tools= in API call - multiple tools all forwarded - empty list ([] and None and default) → tools key absent from call - model tool_call response → JSON-serialised list as A2A reply - multiple tool_calls → all in JSON reply - text content present → text wins over tool_calls Closes #497 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| conftest.py | ||
| test_a2a_cli.py | ||
| test_a2a_client.py | ||
| test_a2a_executor.py | ||
| test_a2a_mcp_server.py | ||
| test_a2a_tools_impl.py | ||
| test_a2a_tools_module.py | ||
| test_agent_base_urls.py | ||
| test_agent.py | ||
| test_approval.py | ||
| test_audit.py | ||
| test_awareness_client_full.py | ||
| test_claude_sdk_executor.py | ||
| test_compliance.py | ||
| test_config.py | ||
| test_consolidation.py | ||
| test_coordinator_parent.py | ||
| test_coordinator_routing.py | ||
| test_delegation.py | ||
| test_events.py | ||
| test_executor_helpers.py | ||
| test_gh_wrapper.sh | ||
| test_governance.py | ||
| test_heartbeat.py | ||
| test_hermes_executor.py | ||
| test_hitl.py | ||
| test_main_initial_prompt.py | ||
| test_mcp_memory.py | ||
| test_medo.py | ||
| test_memory.py | ||
| test_molecule_ai_status.py | ||
| test_namespaces.py | ||
| test_openclaw_adapter.py | ||
| test_platform_auth.py | ||
| test_plugins_builtins.py | ||
| test_plugins_registry.py | ||
| test_plugins.py | ||
| test_preflight.py | ||
| test_prompt.py | ||
| test_routing_policy.py | ||
| test_sandbox.py | ||
| test_security_scan.py | ||
| test_skills_loader.py | ||
| test_skills_watcher.py | ||
| test_telemetry.py | ||
| test_temporal_workflow.py | ||
| test_transcript_auth.py | ||
| test_watcher.py | ||