DEV Community

leo-wang
leo-wang

Posted on • Originally published at leo76868.substack.com

What Actually Happens During a Single LLM Call?

The first time I called the OpenAI API with bare curl, I stared at the JSON response for about thirty seconds. That's it? A POST request, a messages array, back comes a string of text. LangChain wraps it in seven or eight layers and the tutorials make it sound mystical — but at the very bottom it's just an ordinary HTTP request, so ordinary it can't get any more ordinary.

Here's the conclusion that reshaped how I build agents: a so-called "Agent" is, in essence, just an ordinary backend program that calls a stateless LLM API in a loop. Its complexity doesn't live in the model — it lives in how your code manages the messages array. That's why the engineering effort in a production-grade Agent lands overwhelmingly on the memory, orchestration, security, and evaluation layers, not the model layer (which is actually the simplest).

My take: if you can treat every LLM call as an unreliable remote service — timeouts, retries, jitter, cost accounting — you've already outpaced most teams still chasing "magic prompt" tricks. The model layer is the part nobody should be afraid of.

Full articlehttps://leo76868.substack.com/p/what-actually-happens-during-a-single


Production-Grade AI Agents — by Leo Wang · Follow on X · Subscribe

Top comments (0)