Summary
For ReAct agents (e.g., employee hub), the current /extract_tool_call endpoint only returns the first tool call from a single LLM inference. This causes false mismatches — a prompt targeting update_passport gets classified as get_passport because the agent's first step is a lookup before the mutation.
This PR adds a react agent mode that:
- Calls /chat (full agent execution) instead of /extract_tool_call
- Returns all tool calls made during the ReAct loop
- Uses the last tool call as the target tool name
- Snapshots and restores user-declared protected resources (DB files) between each test case to prevent state pollution
Plan
- Add env config — AGENT_MODE (simple|react) and PROTECTED_RESOURCES (comma-separated file paths relative to TARGET_AGENT_PATH)
- Modify /chat response in employee agent — return tool_calls: [{name, args}, ...] alongside the text response
- Add run_extract_tool_args_react() in extract_tool_args.py — snapshot resources → call /chat → take last tool call → restore resources → same comparison logic
- Wire up in CLI — read new env vars, dispatch to react or simple path
Summary
For ReAct agents (e.g., employee hub), the current /extract_tool_call endpoint only returns the first tool call from a single LLM inference. This causes false mismatches — a prompt targeting update_passport gets classified as get_passport because the agent's first step is a lookup before the mutation.
This PR adds a react agent mode that:
Plan