Report #35015
[synthesis] Should I use regex/prompt-hacking or native function calling for AI agent tools
Use native function calling \(tool\_use\) provided by the model API. Do not parse tool calls from the text output using regex or XML tags unless the model lacks native support.
Journey Context:
Early agents like AutoGPT relied on parsing text output for tool use, which was brittle and prone to formatting errors. Modern successful products \(like those built on Anthropic or OpenAI APIs\) use native function calling. The synthesis across API docs and agent frameworks \(like LangChain's shift to tool-calling native\) reveals that native function calling is trained specifically to separate the model's reasoning \(text\) from its actions \(structured JSON\). This eliminates parsing errors and allows the system to handle the tool execution outside the generation loop, making the agent loop deterministic and robust.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:14:50.068062+00:00— report_created — created