AgenticBook
Beginners Guide·~10 min read

Getting Started with AI Agents

A practical, opinionated guide for engineers and product builders. Learn what agents actually are, which frameworks to pick, and how to ship one to production without setting your data on fire.

What is an AI Agent?

An AI agent is a system where an LLM autonomously decides which actions to take to accomplish a goal. Unlike a single prompt → response call, an agent runs a loop: it reasons about the task, picks a tool, observes the result, and decides what to do next.

The minimum ingredients are:

  • A model — usually a chat LLM that supports tool/function calling.
  • Tools — functions the model can invoke (search, code exec, APIs).
  • A control loop — orchestration logic that runs until the goal is met.
  • Memory — short-term (conversation) and long-term (vector store).
The ReAct loop
Most modern agents are built on the ReAct pattern: Reason → Act → Observe → repeat. See the original paper, also indexed under Community & Research.

Core Concepts You'll See Everywhere

Tool Calling / Function Calling
The model returns a structured JSON payload describing which function to invoke with what arguments. Your runtime executes it and feeds the result back.
RAG (Retrieval-Augmented Generation)
Inject relevant documents from a vector store into the prompt so the model can answer with grounded, up-to-date information. Indexed under Memory & Knowledge.
MCP (Model Context Protocol)
An open protocol from Anthropic for connecting LLMs to external tools and data sources in a standardized way. Becoming the USB-C of agent tooling.
Guardrails
Runtime checks that validate inputs, outputs, and tool calls — to prevent prompt injection, PII leaks, and policy violations. See Security & Guardrails.
Evals
Automated test suites for non-deterministic LLM behavior. Treat them like CI for your agent. See Observability & Testing.
Sandbox / Runtime
An isolated environment where the agent can safely execute generated code or browse the web. See Runtimes & Compliance.

How Do I Choose a Framework?

There is no single best framework — the right pick depends on what you're building and what your team already knows. Rough heuristics:

If you want…Start with
Production stateful workflows with branchingLangGraph
Role-based collaborative multi-agent teamsCrewAI
Conversational, event-driven agents (MS stack)AutoGen
Type-safe Python with Pydantic validationPydantic AI
No-code / visual prototypingFlowise or Langflow
Lightweight, minimal Go serviceAgency
Coding-specific autonomous agentOpenDevin or Aider
Avoid framework lock-in early
For your first agent, prototype in 1–2 frameworks before committing. The ecosystem is moving fast — your stack today is unlikely to be your stack in 12 months.

Build Your First Agent in 30 Minutes

  1. Pick a model with reliable tool calling: GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro. Start with a hosted API — don't self-host yet.
  2. Pick a framework. Beginners: start with LangGraph or CrewAI.
  3. Define 2–3 tools — e.g. web search, a calculator, and one domain-specific API. Resist the urge to add 20 tools on day one.
  4. Add observability from day one. Wire up Langfuse or LangSmith before you write your first eval — you'll thank yourself.
  5. Ship a thin slice behind a feature flag. Iterate on real user traces, not imagined ones.
Pro tip: log everything
Every prompt, every tool call, every model response. Storage is cheap; debugging a silently broken agent without traces is not.

Recommended Stacks by Use Case

Customer-support agent
  • LangGraph (orchestration)
  • Pinecone or pgvector (RAG)
  • Langfuse (traces)
  • Guardrails AI (output validation)
Coding agent / dev assistant
  • OpenDevin or Aider
  • E2B Sandboxes (safe code exec)
  • GitHub MCP server
  • Helicone (cost tracking)
Research / browser agent
  • Browser-use or Stagehand
  • Firecrawl (web data)
  • Exa or Tavily (search)
  • Phoenix (Arize evals)
Internal workflow automation
  • CrewAI (role-based)
  • Composio (200+ tool integrations)
  • Temporal (durable execution)
  • Promptfoo (CI evals)

Before You Ship to Production

  • Always sandbox code execution. Never run model-generated code on a host with credentials.
  • Always validate tool inputs. The model will eventually hallucinate a destructive call.
  • Always rate-limit and budget-cap. A runaway loop can burn $1,000 in API calls in an hour.
  • Always log to a trace store with PII redaction, not raw stdout.
  • Always have a human-in-the-loop fallback for irreversible actions (payments, deletes, emails).
Prompt injection is real
Assume any text the agent ingests (web pages, emails, PDFs, tool outputs) may contain hostile instructions. Treat external content as data, never as commands.

Frequently Asked Questions

Do I need a vector database for my first agent?
No. Start with in-memory retrieval or a flat-file knowledge base. Add a vector DB only when you have real documents and real users.
LangChain vs LangGraph — which one?
LangChain is a general-purpose toolbox; LangGraph is a stateful orchestration layer built on top of it. For anything beyond a single linear chain, use LangGraph.
Open-source vs hosted (e.g. OpenAI Assistants)?
Hosted is faster to start but harder to debug and customize. Open-source frameworks give you traces, version control, and portability. Most teams end up on open-source.
How do I evaluate a non-deterministic agent?
Build a golden dataset of inputs + expected behaviors. Use LLM-as-judge for qualitative checks, plus deterministic assertions on tool calls and final outputs. See Observability & Testing.
What's the difference between an agent and a workflow?
A workflow has a predefined path; an agent decides its own path at runtime. Use workflows for predictable tasks, agents for open-ended ones. Many production systems mix both.

Ready to explore the full directory?

Browse Frameworks