Skip to content
seekho.
← Build AI Agents from Scratch

Whole course on one page

Build AI Agents from Scratch: 8 lessons, a few lines each. About 5 minutes to read. Use it to preview the course or to revise.

From Chatbot to Agent

  1. 1. What Makes Something an Agent opens the one-minute view

    A chatbot answers one message. An agent works towards a goal over many steps. It uses tools and looks at each result.

    Steps: 1. Write down a task with several steps · 2. List the tools for each step · 3. Mark where a result must be checked

    ✗ Calling any chatbot that answers one message an agent ✓ Checking for all three: a model, tools and a loop

    Words: Agent, Model, Tool, Loop

    📌 Model + tools + loop = agent.

  2. 2. Tools: Giving the Model Hands opens the one-minute view

    A model can only write text. With tool use, the model asks for a function to run, and your code runs it.

    Steps: 1. Give the tool a name · 2. Write a clear description · 3. Define the input schema · 4. Write the real function · 5. Send the result back to the model

    ✗ Writing a vague tool description ✓ Saying exactly what the tool does and when to use it

    Words: Tool use, Input schema, Description

    📌 The model asks; your code does.

Building the Agent Loop

  1. 3. Writing the Loop by Hand opens the one-minute view

    The agent loop sends the conversation to the model. It runs any tool the model asks for, adds the result, and repeats.

    Steps: 1. Send the conversation and tools · 2. Check the model's reply · 3. Run the requested tool · 4. Add the result to the messages · 5. Repeat, up to max_steps

    ✗ Writing the loop with no step limit ✓ Setting max_steps so the loop always ends

    Words: Agent loop, messages, Stop reason, max_steps

    📌 Ask, run, add result, repeat. Always with a step limit.

  2. 4. Planning and Handling Errors opens the one-minute view

    Tools fail in real use. Catch the error and send a clear message back to the model, so it can try another way.

    Steps: 1. Wrap each tool call · 2. Return the error as the tool result · 3. Mark it as an error · 4. Ask for a short plan first · 5. Have it check the plan after results

    ✗ Letting a tool error crash the whole program ✓ Returning the error as a message the model can read

    Words: System prompt, Error message, Plan

    📌 Turn failures into messages the model can read and react to.

  3. 5. Memory: Short-Term and Long-Term opens the one-minute view

    An agent forgets everything between runs. The messages list is its short-term memory. Saved files give it long-term memory.

    Steps: 1. Summarise old steps · 2. Trim big tool results · 3. Save important facts to a file · 4. Load facts when needed

    ✗ Expecting the agent to recall facts from an earlier run ✓ Saving key facts to a file and loading them later

    Words: Short-term memory, Long-term memory, Context window

    📌 Messages are the whiteboard; saved storage is the notebook.

Making Agents Safe and Reliable

  1. 6. Guardrails and Human Approval opens the one-minute view

    An agent with strong tools can do harm by mistake. Give it only the tools it needs. Let a person approve risky actions.

    Steps: 1. Give only the tools it needs · 2. List the risky tools · 3. Pause and ask a person · 4. Tell the model if it was denied · 5. Treat tool results as data

    ✗ Letting text from a web page act as a command ✓ Treating everything a tool returns as data only

    Words: Least privilege, Human in the loop, Prompt injection

    📌 Fewest tools possible, and a human checks anything risky.

  2. 7. Testing and Measuring Your Agent opens the one-minute view

    Trying an agent once does not show that it works. Build a fixed set of test tasks and run them after every change.

    Steps: 1. Write 10 to 20 real test tasks · 2. Run each case a few times · 3. Record the numbers · 4. Change one prompt or tool · 5. Rerun everything and compare

    ✗ Trying one example by hand after a change ✓ Rerunning the full eval set and comparing the score

    Words: Eval, Success rate, Steps used, Wrong tool calls

    📌 If you do not measure it, you do not know it works.

  3. 8. Project: A Research Assistant Agent opens the one-minute view

    You build a small research agent in Python without a framework. It uses tools to answer a question and saves a short note.

    Steps: 1. Write the loop with max_steps · 2. Add at least three tools · 3. Catch tool errors · 4. Put save_note behind approval · 5. Run 8 eval tasks, 3 times each

    ✗ Letting save_note write without asking anyone ✓ Asking a person to approve every write action

    Words: Framework, save_note, Eval set

    📌 Loop, tools, error messages, approval, memory, evals: build each part by hand.

This page is a summary. It does not replace the lessons, where each idea has an example, pictures and practice.