Build Your First AI Agent
From a single LLM call to an autonomous multi-step agent — the practical path.
What makes something an agent?
An AI agent isn't just an LLM. It's an LLM in a loop: observe the environment, reason about what to do next, take an action (call a tool, write a file, search the web), then observe again. The key difference from a one-shot prompt is that the model decides when it's done — not you.
The three primitives you need
Every agent needs three things: (1) A system prompt that defines the agent's role and constraints. (2) A set of tools the model can call — functions your code exposes with JSON schemas. (3) A loop that runs until the model emits a final answer or a stop condition is hit. That's it. Start there before adding memory, planning, or multi-agent orchestration.
Choosing your framework
For most use cases, the Anthropic Claude SDK (Python or TypeScript) is the right starting point — tool use is built-in, streaming works, and you're talking directly to the model with no abstraction layer. For more complex multi-agent systems, consider LangGraph (stateful, graph-based) or CrewAI (role-based crews). n8n and Make are excellent for no-code agents over APIs. Avoid adding a framework until you've built one agent without one — the framework will make more sense once you understand what it's abstracting.
Tool design: the most important skill
Your agent is only as capable as its tools, and tool design is the hardest part. Good tools: (1) Do exactly one thing. (2) Have precise JSON schemas with descriptions the model can understand. (3) Return structured, machine-readable output. Bad tools are vague, do multiple things, or return raw HTML the model has to parse. Design each tool as if you were writing an API — the model is your caller.
Production checklist
Before deploying: add a max_steps limit to prevent runaway loops. Log every tool call and model response for debugging. Set a token budget and kill the loop if exceeded. Add human-in-the-loop checkpoints for irreversible actions (sending emails, writing to databases, calling paid APIs). Test the failure path — what happens when a tool returns an error? The model should recover gracefully.
More Intermediate guides
RAG Architecture: Ground AI in Your Data
Build retrieval-augmented generation pipelines that give models access to your documents.
Fine-Tuning vs. Prompting
When a well-crafted prompt is enough — and when you genuinely need a custom-trained model.
AI Cost Optimization Playbook
Cut your AI API spend by 60–90% without sacrificing quality — techniques that actually work.