Files
ai-agent-book/slides/lesson-21.md
T
liqiang b119135836
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

7.6 KiB

theme, title, info, author, transition, mdc, lineNumbers, monaco, aspectRatio, canvasWidth, layout, class
theme title info author transition mdc lineNumbers monaco aspectRatio canvasWidth layout class
seriph Lesson 21 — How Can Code Let an Agent Create New Capabilities? English video course for AI Agents in Depth Bojie Li slide-left true false false 16/9 980 cover 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
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

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

$ 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.