Odysseus
The book

Building a personal agent, from first principles.

A textbook, and the graduate course built on it, on how to build an assistant that lives in a chat, holds its owner's accounts, acts without being asked, and asks before anything that cannot be undone. Every mechanism is explained from the idea down to the code that runs.

What kind of book this is. It describes a real, open-source system that one person uses every day and that is still being built. Every claim about what was run is graded by how it is known, and anything not yet run is marked as such. The grades are explained in How to read the evidence. Read that page first; it takes three minutes.

How to read it

The chapters are organised by idea, not by the order in which things were built. Each one states what you will be able to do, defines its terms before using them, shows the design and the reasons for it, walks through the code that runs, states its claims in a common formal model, says what went wrong in practice, places the design against the published literature, and ends with problems in five groups. Chapters refer to each other by number, and can be read out of order once Part I is behind you.

To understand how agents work

Read Part I, then the chapters on the conversation, memory and the gate. That is the smallest complete picture.

To build one

Read straight through to the end of Part IV with the repository open, and do the laboratories as you go.

To study it as a course

Start with the syllabus: fourteen weeks, primary readings, five laboratories, five problem sets, a project and an examination.

To make one safe

Read Part III in full, then the chapters on evaluation and on a second reading in Part V.

Contents

Part I · Foundations

What a personal agent is, how a model and its tools make a loop, and how to decide what to build.

  1. 1What a personal agent is

    What separates a personal agent from a chatbot, the vocabulary the book uses, why a result counts only when something other than the agent checks it, what commercial agents share and how they have failed, and what a first system leaves out.

  2. 2The agent loop: models, tools and turns

    How single model calls and tool calls combine into a loop that answers one message, why context is finite, how code rather than the model decides what runs, and what the smallest working agent must contain.

  3. 3Deciding what to build and what to buy

    How to split an agent into parts, buy each unless building is verifiably better, read a benchmark sceptically, settle thin evidence by measuring vendors on your own data, and order the build as thin slices.

Part II · The core

The parts every such system has: a conversation that can be stopped, memory, acting without being asked, and staying up.

  1. 4The conversation: a thread that answers, stops and stays in budget

    How the control layer around an agent loop decides who may speak, queues messages behind a running task, stops in two layers, enforces limits per task and per day, and derives cost, status and interruptions from one append-only journal.

  2. 5Memory

    Why a model forgets, how to keep lasting facts and dated notes in plain files the owner controls, when to show them to the model, how to change a fact without losing its history, and why saves after reading strangers' writing are asked about.

  3. 6Acting unasked: reminders, routines, watches and briefs

    How an agent speaks first: four mechanisms sorted by what triggers them and who decides, why unattended runs get fewer tools, why silence must be recorded, and why code rather than the model does everything it can.

  4. 7Staying up: restarts, sessions and hosting

    What an agent needs to be there tomorrow: keeping a conversation across restarts, announcing interrupted work instead of resuming it, refusing stale messages, restarting through a supervisor, and hosting with no inbound port, a pinned clock and data kept apart from code.

Part III · Safety

Who decides what runs, what to do about words other people wrote, and how to hold secrets.

  1. 8The gate: who decides what runs

    Why a model's good behaviour cannot be the safety boundary, and how code decides instead: allow, ask or refuse, questions written by the program, one-use approvals, asking less without losing control, and how to test it all.

  2. 9Untrusted content: prompt injection and taint

    Why a model cannot be trusted to ignore instructions hidden in what it reads, and the code-level defences that limit the damage: labelling material, restricting runs that have read it, plain-text taint tracking, hiding sign-in codes, and readers with no tools.

  3. 10Secrets, sign-ins and the addresses a program opens

    Where an agent's credentials should live, how to sign in as the owner with OAuth and the narrowest permissions, how to state an exception to a safety rule honestly, and how to open addresses other people typed without server-side request forgery.

Part IV · Hands and senses

How the agent reaches the world: accounts, apps, servers, a browser, files, voice and channels.

  1. 11Mail and calendar

    How to give an agent narrow, hand-written tools for mail and calendar: what the model is shown of a message, how an approval question is built from real fields, re-reading before acting, and checking whether a timed-out write happened before retrying.

  2. 12Any app: connectors and the two-tool pattern

    How to give a model thousands of actions without showing it thousands of tools: one tool to find, one to run, sorting unknown actions into read or change by name and label, connecting apps from the chat, and when a service's own server is better.

  3. 13Services with their own server, and connecting one from the chat

    How an agent reaches services that run their own MCP server: choosing a route, deciding which vendor tools run unasked, making a connection read-only, describing a service to the model, and letting only the owner connect a new server by name.

  4. 14The browser

    When an agent must use a browser, why the gate can only decide whether a run starts, how signed-in runs and task-writing work, and how to turn a recurring browser errand into a fixed procedure whose results code can check.

  5. 15Files, pictures, pages and voice

    How photos, documents, recordings and links reach a model that works in text: choosing between showing and recognising, numbering pages, recovering charts with a tool-less reader paid for once, showing back what was heard, and what to record.

  6. 16Channels: Telegram, WhatsApp and what a channel must provide

    What an agent needs from a chat platform, how to keep each platform behind a small interface, why a webhook needs a guarded door, and how to design around a platform's rules: messaging windows, link previews and late deliveries.

Part V · Knowing it works

Tests, evaluations, a world that changes, what a second reading finds, and what it all costs.

  1. 17Testing and evaluation

    How tests (the program with a stand-in model) and evaluations (the real model on real errands in a resettable world) differ, and how to build checks that look at the world, invariants, a zero baseline, honest pass rates and live checks.

  2. 18A world that does not hold still

    Why an agent judged in a frozen, hand-written world looks better than it is, and how to build an evaluation world with time, events, people and faults, check properties on every run, spot the evaluation's own failures, and learn from traces.

  3. 19A second reading: what tests do not find

    Why a passing suite misses what nobody thought to test, and how an independent reading, use in a lived-in state and real end-to-end runs find holes in the gate, silent failures, misleading numbers and wrong assumptions about real services.

  4. 20Cost: budgets, the ledger and where the money goes

    How to reason about what an agent costs: tokens and context length, caching, metered services, a ledger derived from the journal by one function, estimates where vendors report no price, budgets that stop work, and design changes that pay for input once.

Part VI · A worked application

An assistant for a venture firm: the mechanisms of the earlier parts composed into something a user wants.

  1. 21A firm's database: layout, intake and plans

    How to give an empty customer database a shape, tell the model its layout, and file a whole source as one plan the program checks and the owner approves once, with lookups, before-and-after changes and a second look at the moment of acting.

  2. 22Decks, links and data rooms

    How to compose reading, searching, filing and replying into one errand on material written to persuade: a pitch deck read with its pictures, filed as claims, answered with a take of fixed shape, whether it arrives as a file, a link or a viewing site.

  3. 23Sourcing: digests, signals and choosing a data vendor

    How to build an unattended daily digest that reads metered services safely and does not repeat itself, what public search can and cannot find, and how to choose a paid data vendor by measuring it on companies the firm already knows.

  4. 24A fund's weekly work: the review, the figures and the sums

    How to sort a firm's recurring work into comparisons, reading and procedure: a pipeline review made by code from the database's own layout, companies' reported figures kept as numbers, round maths taken away from the model, and procedures shipped as skills the owner can replace.

  5. 25What is built, what is not, and what comes next

    How to keep an honest status map of an agent, grading each capability by the kind of run behind it, and the map itself: what has run live, what never has, the known faults, and the open problems in order.