Apply 12 concrete architectural principles to build AI agents where you control the prompts, context window, control flow, and human-in-the-loop checkpoints instead of delegating them to framework abstractions.
| Observation | Detail |
|---|---|
| Most production "AI agents" are not very agentic | Mostly deterministic code with LLM steps sprinkled in at just the right points |
| Frameworks rarely seen in production | Most strong founders building customer-facing agents are rolling the stack themselves |
| Good agents are mostly just software | They don't follow the "here's your prompt, here's a bag of tools, loop until you hit the goal" pattern |
context = [initial_event]
while True:
next_step = await llm.determine_next_step(context)
context.append(next_step)
if next_step.intent == "done":
return next_step.final_answer
result = await execute_step(next_step)
context.append(result)
Three-step loop: (1) LLM determines next step via structured JSON tool calling, (2) deterministic code executes the tool call, (3) result is appended to context window. Repeats until LLM determines "done." Initial context can be a user message, cron event, or webhook.
| Factor | Principle |
|---|---|
| 1 | Natural Language to Tool Calls |
| 2 | Own your prompts |
| 3 | Own your context window |
| 4 | Tools are just structured outputs |
| 5 | Unify execution state and business state |
| 6 | Launch/Pause/Resume with simple APIs |
| 7 | Contact humans with tool calls |
| 8 | Own your control flow |
| 9 | Compact errors into context window |
| 10 | Small, focused agents |
| 11 | Trigger from anywhere, meet users where they are |
| 12 | Make your agent a stateless reducer |
Even as LLMs get exponentially more powerful, core engineering techniques will make LLM software more reliable, scalable, and maintainable
↓
Going all-in on a framework and building a greenfield rewrite may be counter-productive
↓
The fastest path: take small, modular concepts from agent building and incorporate them into your existing product
↓
These modular concepts can be applied by most skilled software engineers, even without an AI background