Date: 2026-01-24 Issue: "Function run_one_shot not found" during tool execution Status: ✅ Fixed
When the assistant suggested using the run_one_shot tool and user confirmed:
cmbchat_assistant: I can create a Python script that...
Shall I proceed?
user: yes
cmbchat_assistant: ***** Suggested tool call: run_one_shot *****
Arguments: {...}
>>>>>>>> EXECUTED FUNCTION run_one_shot...
Output:
Error: Function run_one_shot not found.
The tool was being suggested but not executed.
In the AG2/AutoGen framework, there's a distinction between:
- Seeing a tool (LLM knows about it, can suggest it)
- Executing a tool (Agent can actually run it)
toolkit.register_for_llm(assistant)
toolkit.register_for_execution(assistant) # ❌ Wrong agentThis registers tools for both seeing and executing on the assistant agent.
In AG2's architecture:
AssistantAgentwith LLM → Suggests tools, generates responsesUserProxyAgentwithout LLM → Executes tools, handles human input
Tools must be executed by the UserProxyAgent, not the AssistantAgent.
# Register tools for LLM (assistant can see and suggest them)
toolkit.register_for_llm(assistant)
# Register tools for execution (MUST be on user_proxy in AG2)
toolkit.register_for_execution(user_proxy)- Assistant sees the tool via
register_for_llm→ Can suggest it to user - User proxy executes the tool via
register_for_execution→ Can actually run it - Standard AG2 pattern for tool-using agents
┌────────────────────────────────────────┐
│ AssistantAgent (with LLM) │
│ - Sees tools (register_for_llm) │
│ - Suggests tool calls in responses │
│ - Does NOT execute tools │
└──────────────┬─────────────────────────┘
│
│ Suggests: "Use run_one_shot"
↓
┌────────────────────────────────────────┐
│ UserProxyAgent (no LLM) │
│ - Executes tools (register_for_exec) │
│ - Gets human input │
│ - Runs actual tool functions │
└────────────────────────────────────────┘
After the fix, the flow should be:
user: "What's the sum of two Gaussians?"
cmbchat_assistant: I can create a Python script that:
- Defines two Gaussian functions
- Computes their sum
- Plots the visualization
This takes ~30 seconds. Shall I proceed?
user: yes
cmbchat_assistant: ***** Suggested tool call: run_one_shot *****
Arguments: {"task": "...", "max_rounds": 5}
>>>>>>>> EXECUTING FUNCTION run_one_shot... ✅ Works!
Output: {"status": "success", "work_dir": "...", ...}
cmbchat_assistant: ✓ Script created successfully!
I've generated 'gaussian_sum.py' in ./cmbchat_work/...
From AG2 docs on tool registration:
register_for_llm(agent)- Makes tool visible to the agent's LLMregister_for_execution(agent)- Allows agent to execute the toolregister_tool(agent)- Shorthand for both (not used here)
Standard pattern for assistant + user_proxy:
# Pattern 1: AssistantAgent suggests, UserProxyAgent executes
tool.register_for_llm(assistant)
tool.register_for_execution(user_proxy)
# Pattern 2: Both can suggest and execute (less common)
tool.register_tool(assistant)
tool.register_tool(user_proxy)We use Pattern 1 because:
- Only assistant has LLM, so only it can intelligently suggest tools
- User proxy handles execution and human interaction
- Clear separation of concerns
git commit -m "Fix: Register tools for execution on user_proxy, not assistant"To test the fix:
cd /Users/boris/GitHub/cmbchat
cmbchat
# Test interaction:
> What's the sum of two Gaussians?
> yes
# Should now execute successfully without "not found" errorIf you see other tool-related errors:
- "Tool not found" → Check
register_for_llmis on assistant - "Cannot execute" → Check
register_for_executionis on user_proxy - "Tool not suggested" → Check tool is in toolkit and LLM sees it
- "Tool executes but no result" → Check tool's return value format
✅ Fixed and committed ✅ Ready for testing ✅ Should work correctly now
Next step: Restart cmbchat and try the Gaussian question again!