---
theme: seriph
title: "Lesson 21 — How Can Code Let an Agent Create New Capabilities?"
info: "English video course for AI Agents in Depth"
author: Bojie Li
transition: slide-left
mdc: true
lineNumbers: false
monaco: false
aspectRatio: 16/9
canvasWidth: 980
layout: cover
class: cover
---
Build · Chapter 5 · Coding Agents
# How Can Code Let an Agent Create New Capabilities?
Adapters, generative UI, hot repair, and Agent bootstrapping
Lesson 21 of 42 · 19 minutes · Code as a System Adapter; Generative UI; Agent Bootstrapping
---
# Why this problem matters
Adapter
Translate unstable external formats into stable internal ones.
Interface
Generate a UI that matches the current intent.
Bootstrap
Create a specialized Agent from a validated reference.
---
# Three ideas to keep in view
Hot repair
Failure sample → generated parser → tests → registration
Artifact pattern
Pass paths and queries instead of moving large data through tokens
Validated generation
Compile, test, scan, and exercise generated Agents
---
# The book's visual model
Pipeline of an Agent that creates Agents
---
# One-off generation vs. Capability creation
One-off generation
- Produces an artifact
- Capability disappears after task
- No reuse gate
Capability creation
- Packages implementation
- Validates and versions it
- Reuses on later tasks
Bootstrapping begins when output becomes part of the next Agent.
---
# Capability promotion needs gates
~~~python
candidate = agent.generate_tool(failure_sample)
compile(candidate)
run_security_scan(candidate)
run_regression_tests(candidate)
registry.promote(candidate)
~~~
---
# Test the claim
5-72 min
Repair an unknown log format
Observe: Failure detection, generated parser, tests, and later reuse
5-92 min
Generate a dynamic form
Observe: Intent gaps converted into fields and cascading constraints
5-122 min
Inspect Agent-creation validation gates
Observe: Scratch versus template generation, compile, tests, and protocol audit
Demo budget: 6 minutes · one contiguous terminal block
---
class: course-terminal
---
Live demo
# Switching to the terminal
~~~bash
$ uv run python chapter5/adaptive-log-parser/demo.py --offline
$ uv run python chapter5/dynamic-form/demo.py --offline
$ uv run python chapter5/agent-creator/demo.py --no-live --output chapter5/agent-creator/runs/course-smoke
~~~
Run the command(s), narrate decisions, and point to the observation—not just the output.
---
# What the evidence supports
Finding 1
Generated adapters let a system follow changing data formats.
Finding 2
Generative UI moves structured clarification out of slow chat turns.
Finding 3
Reference-based Agent creation preserves a proven loop while specializing tools.
---
# Boundary → design rule
Self-modification is unsafe when the Agent can alter the validator that approves its own changes.
Promote generated code into capability only after independent security, functional, and reuse checks.
---
# Continue the experiment
---
layout: center
class: text-center
---
Pause and apply
# Your turn
Which generated artifact is safe to reuse, and who decides that it has become a capability?
---
layout: center
class: text-center
---
Build complete · Next · Lesson 22
Measure whether any of these architectural changes actually improve the Agent.
→