A Tour of Agents

Build your first AI agent
in 60 lines of Python.

No frameworks. No setup. Runs entirely in your browser.

9 interactive lessons that teach the primitives behind LangChain, CrewAI, and AutoGen.

Open sourceRuns in your browser via PyodideNo signup required

This is the entire agent loop

while True:
    response = llm(messages, tools)

    if response.tool_call:
        result = run_tool(response.tool_call)
        messages.append(result)
    else:
        break
User
LLM
Tool
Result
LLM
Done

Watch the loop run. This is what every agent framework does.

The Learning Path

Each lesson adds one concept. ~60 lines total.

1

The Agent Function

19 lines

An agent is a function that calls an LLM. That's it.

2

Tools = Dict

30 lines

The LLM picks a tool by name. You dispatch with tools[name](**args).

3

The Agent Loop

32 lines

LLM calls a tool, gets the result, decides again. This IS AgentExecutor.

4

Conversation = Messages Array

35 lines

The messages array persists across calls. That's how agents remember within a session.

5

State = Dict

39 lines

Track structured data alongside the messages array.

6

Memory Across Runs

36 lines

Conversation dies per session. Memory survives forever.

7

Policy = Guardrails

50 lines

Gates before the LLM and after it. The agent obeys rules.

8

Self-Scheduling

42 lines

The agent enqueues its own follow-up work. BFS over a task queue.

9

The Whole Thing

60 lines

All 8 concepts composed in ~60 lines. This is a framework.