Skip to content

Add native LLM tool call support with ReAct fallback#95

Draft
yzx9 wants to merge 1 commit into
mainfrom
feature/tool-call
Draft

Add native LLM tool call support with ReAct fallback#95
yzx9 wants to merge 1 commit into
mainfrom
feature/tool-call

Conversation

@yzx9

@yzx9 yzx9 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator
  • Add prompt_template.py: minimal Jinja2-like {% if %} conditional renderer
  • Add ToolCallMessage/ToolResultMessage unified message types
  • Add detect_tool_call_mode() using LiteLLM model capability DB
  • Update model_client.py: format tool messages for OpenAI Chat/Responses API
  • Update react_parser.py: _convert_messages() converts tool messages back to TextMessage for ReAct fallback
  • Update agent.py: Thought extraction post-processing for native mode
  • Update leader_multiagent.py: unified Agent layer, mode detection in init
  • Update leader_prompts.py: conditional {% if tool_call_mode %} sections
  • Update Executor.py: conditional prompt building per client type
  • Update agent_loader.py: render_prompt() when loading TOML configs
  • Update agent TOML configs with template conditionals
  • Fix prompt_template.py regex bug: {% %} delimiters were never matched
  • Fix prompt_template.py elif logic: three-tuple stack for branch tracking

Tests: 143 pass (40 new), lint clean

- Add prompt_template.py: minimal Jinja2-like {% if %} conditional renderer
- Add ToolCallMessage/ToolResultMessage unified message types
- Add detect_tool_call_mode() using LiteLLM model capability DB
- Update model_client.py: format tool messages for OpenAI Chat/Responses API
- Update react_parser.py: _convert_messages() converts tool messages back
  to TextMessage for ReAct fallback
- Update agent.py: Thought extraction post-processing for native mode
- Update leader_multiagent.py: unified Agent layer, mode detection in init
- Update leader_prompts.py: conditional {% if tool_call_mode %} sections
- Update Executor.py: conditional prompt building per client type
- Update agent_loader.py: render_prompt() when loading TOML configs
- Update agent TOML configs with template conditionals
- Fix prompt_template.py regex bug: {% %} delimiters were never matched
- Fix prompt_template.py elif logic: three-tuple stack for branch tracking

Tests: 143 pass (40 new), lint clean
@yzx9 yzx9 added the enhancement New feature or request label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant