Two Ways to Build AI Agents

2026/03/08

Tonight I built two agents from scratch using raw OpenAI API calls — no frameworks — to understand the fundamental architecture patterns behind AI agents.

Approach 1: ReAct Agent (planner-agent)

The LLM does everything — it decides what step to run next, executes tools, observes results, and loops until done.

User goal → LLM plans → tool call → LLM observes → tool call → ... → done

The core is a single loop: send messages to the LLM, execute any tool calls it requests, feed results back, repeat. The system prompt tells it to “plan, execute, adapt, report” — but the LLM interprets that however it wants.

What I noticed:

Approach 2: Structured Pipeline (publishing-agent)

I write notes in Obsidian daily — ideas, research, meeting notes, project logs. Some of them are worth publishing as blog posts, but it could be time consuming to review them. So I built an agent for this: it scans my vault for recently modified notes, ranks which ones are most ready to publish, drafts a polished version of the top pick, then self-reviews its own draft.

The point is that this workflow is known in advance — I don’t need an LLM to figure out the steps. I need it to provide judgment (which note is best?) and writing skill (turn rough notes into a blog post draft). So the code orchestrates a fixed pipeline, and the LLM is called only at specific points where intelligence is needed.

SCAN (code) → READ (code) → RANK (LLM) → DRAFT (LLM) → REVIEW (LLM)

Each step is a Python function. The LLM never decides “what’s next” — it only provides judgment and writing within a step it’s been assigned.

What I noticed:

The Key Insight

In a ReAct agent, the LLM is both the orchestrator and the intelligence engine. In a production agent, you separate these concerns:

ReActProduction
OrchestrationLLM decidesCode decides
IntelligenceLLM providesLLM provides
WorkflowEmergentExplicit
PredictabilityLowHigh
Best forOpen-ended tasksKnown workflows

In summary, ReAct still has its place — for truly open-ended tasks where you can’t predefine the steps. But for any domain-specific product (publishing, data analysis, code review), the structured pipeline is the way to go.

Repos