Skip to content

Commit b1a6c4c

Browse files
Fix missing content from typst migration (#5)
* Restore missing content from typst migration - Add introduction.mdx with book overview, audience, and usage guide - Fill in empty Steps 2-5 in chapter 23 (first agent in production) - Fix truncated @typescript-eslint package names in chapter 33 - Restore missing 'thank you' paragraph in preface Co-authored-by: Ona <no-reply@ona.com> * Remove book-only 'thank you' paragraph from preface This paragraph is meant for the PDF/EPUB book, not the website. Co-authored-by: Ona <no-reply@ona.com> * Unwrap hard line breaks, replace emdashes with hyphens Co-authored-by: Ona <no-reply@ona.com> * Remove introduction.mdx - content already covered by index page The introduction content is front matter for the book format (typst/EPUB), not a standalone chapter. The website's index page /About section already covers the audience and scope. Co-authored-by: Ona <no-reply@ona.com> --------- Co-authored-by: Ona <no-reply@ona.com>
1 parent 4a9653d commit b1a6c4c

2 files changed

Lines changed: 71 additions & 5 deletions

File tree

src/content/chapters/23-first-agent-production.mdx

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,80 @@ observability:
4949
```
5050
5151
### Step 2: Configure MCP servers (30 minutes)
52+
Connect the agent to the tools it needs. At minimum, configure MCP
53+
servers for your filesystem (so the agent can read and write code), your
54+
version control system (so it can create branches and commits), and your
55+
test runner (so it can execute tests and read results). If your project
56+
uses a database, add a read-only database MCP server using the BFMCP
57+
pattern (Chapter 11) - expose high-level query operations, not raw SQL.
58+
59+
Start with 3-5 MCP servers. More than 10 creates tool definition bloat
60+
that wastes tokens on every turn (Chapter 5 covers Meta-MCP for
61+
compressing tool definitions). You can always add more servers later as
62+
the agent's scope expands.
63+
64+
Verify each MCP server works independently before connecting it to the
65+
agent. Call each tool manually, confirm the response format, and check
66+
that error cases return structured error messages the agent can
67+
interpret.
68+
5269
### Step 3: Set up observability (45 minutes)
70+
You cannot debug agent failures without traces. Set up OpenTelemetry
71+
(Chapter 14) to capture every agent session as a trace, with spans for
72+
each LLM call, tool call, and decision point.
73+
74+
Configure your observability backend - Langfuse, Arize Phoenix, or
75+
Grafana Tempo with the OpenTelemetry exporter. At minimum, every trace
76+
should capture:
77+
78+
- **Session metadata:** session ID, task description, initiating user
79+
- **LLM calls:** model name, input/output token counts, latency, cost
80+
- **Tool calls:** tool name, arguments, response size, success/failure
81+
- **Cost:** cumulative cost per session, with per-call breakdown
82+
83+
Set up two alerts from day one: one for sessions exceeding your cost cap
84+
(\$3 default), and one for sessions exceeding your duration limit (30
85+
minutes default). These catch runaway agents before they become
86+
expensive.
87+
5388
### Step 4: Configure CI/CD integration (30 minutes)
89+
Agent-generated code must pass the same quality gates as human-written
90+
code. Configure your CI pipeline to run the full backpressure stack
91+
(Chapter 32) on every agent-created pull request:
92+
93+
1. **Type checking** - `tsc --noEmit`, `mypy`, or `go vet`
94+
2. **Linting** - ESLint, Ruff, or golangci-lint with strict rules
95+
3. **Tests** - run affected tests, not the full suite (use `--changedSince` or pytest-testmon)
96+
4. **Security scanning** - Semgrep or CodeQL for SAST
97+
98+
Configure the agent to read CI failure output so it can self-correct.
99+
The agent should be able to push a fix and re-trigger CI without human
100+
intervention. Set a maximum of 3 CI retry cycles - if the agent can't
101+
pass CI after 3 attempts, escalate to a human with the full trace.
102+
54103
### Step 5: First run (30 minutes)
104+
Pick a low-risk task for the first run: a well-defined bug fix with a
105+
failing test, a documentation update, or adding unit tests for an
106+
untested function. Avoid database migrations, authentication changes, or
107+
public API modifications.
108+
109+
Write a clear task specification: what the agent should do, what files
110+
it should touch, what tests should pass when it's done, and what it
111+
should not change. Vague specifications produce vague output.
112+
113+
Run the agent and watch the trace in real-time. Don't intervene unless
114+
the agent is clearly stuck or approaching the cost cap. The goal of the
115+
first run is to observe the agent's behavior, not to get a perfect
116+
result. Note where the agent hesitates, makes wrong assumptions, or
117+
lacks context - these observations will inform your AGENTS.md updates.
118+
55119
### Step 6: Monitor and iterate (ongoing)
56-
After the first successful run: 1. Review the agent trace in your
57-
observability dashboard 2. Check cost and token usage 3. Identify any
58-
context gaps (update AGENTS.md) 4. Gradually expand to more complex
59-
tasks
120+
After the first successful run:
121+
122+
1. Review the agent trace in your observability dashboard
123+
2. Check cost and token usage
124+
3. Identify any context gaps (update AGENTS.md)
125+
4. Gradually expand to more complex tasks
60126

61127
## Workflow: Setting up Distill for monorepo context
62128
**Estimated time:** 30 minutes

src/content/chapters/33-adoption-playbook.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ introducing agents.
5959
npx tsc --init --strict
6060

6161
# ESLint with strict rules
62-
npm install -D /eslint-plugin /parser
62+
npm install -D @typescript-eslint/eslint-plugin @typescript-eslint/parser
6363
# Enable: No-explicit-any, no-unused-vars, no-floating-promises
6464

6565
# Pre-commit hooks

0 commit comments

Comments
 (0)