By safa of Orqisai
The 3 hardest technical problems I hit building an AI agent that calls real APIs. I wish someone had written [these] down before I spent a month figuring them out:
1. LLMs send partial payloads on write operations.
You ask the agent to update a record. It sends only the fields you mentioned in the prompt. The PUT request goes through, returns 200, and you've silently wiped every field you didn't specify.
The fix: Before every write call, fetch the current resource state via the companion GET endpoint and deep-merge the LLM's payload on top. The LLM only needs to specify what's changing β the executor fills in the rest.
2. LLMs hallucinate success when API calls fail.
A tool returns a 404. The agent says, "Done, the record was updated!"
The fix: Explicitly prefix every error response with "Error:" and add one line to the system prompt β if a tool returns a message starting with Error:, report it directly. Do not assume success. Without this, the agent will confidently lie every time.
3. Query parameters break in subtle ways.
The LLM passes query params as a plain string instead of a dict. The request fires, looks fine in logs, returns nothing. No error. Just silence.
The fix: Coerce string inputs to dicts in the tool executor and be extremely explicit in the field description about the expected shape β including a concrete example.
None of this shows up in tutorials or documentation. You only find it by shipping something real and watching it break. If you're building anything that connects an LLM to a real API, what failure modes have you hit?