astorlm
Agent Harness Patterns
Level 0
Your toolkit
The pieces before any agent: the model, the system prompt, the messages you resend, and a first tool.
Coming soon
How AI agents work, from scratch
An AI agent is a language model inside a loop with tools: it reads the request, asks for a tool, gets the result back, and decides what to do next until the job is done. Agent Harness Patterns explains that loop one piece at a time, in 17 short patterns that build on each other.
Each pattern shows the problem, an animated trace of an agent solving it, and the code twice: from scratch in TypeScript and Python, and with astorlm, the open-source TypeScript agent SDK the patterns come from.
The fundamentals track
-
0
Your toolkit
The pieces before any agent: the model, the system prompt, the messages you resend, and a first tool.
-
1
What is an agent?
The difference between calling a model, building a workflow, and letting the model decide what to do.
-
2
Agent Loop
Call the model, run the tools it asks for, hand back the results, and repeat until it's done.
-
3
Designing a tool
Name, description and schema: all the model ever knows about a tool.
-
4
When to stop
end_turn, turn limits and terminal tools: the ways to end the loop.
-
5
Errors in the loop
A failing tool doesn't break the agent: the error goes back as a result and the model recovers.
-
6
Hooks
The points where your code steps into the loop: before each turn, each model call, each tool run.
-
7
The backpack fills up
What happens when the history no longer fits the context window, and how to compact it.
-
8
On-demand skills
A light catalog always at hand, and the full manual only when needed.
-
9
Memory
Remembering across sessions: saved history, files and search by meaning.
-
10
Fresh laps
When the job outgrows one session: a fresh agent each lap, with the progress saved in files.
-
11
Observability and evals
See what the agent did, what it cost, and whether it did it well.
-
12
Plan and reflect
Think the plan through before touching anything, and review the result before handing it over.
-
13
Human in the loop
Ask for permission, take corrections mid-way, and escalate when in doubt.
-
14
Security and sandboxing
Lock up what the agent runs, and distrust what it reads.
-
15
Subagents
Hand a subtask to another agent with its own clean context.
-
16
Proactive agents
Agents that wake up on their own: a heartbeat, a cheap check first, and a message only when it matters.
Build it with astorlm
The agent loop as a library: an embeddable, SDK-first agentic runtime for TypeScript.
pnpm add astorlm
Using an AI coding assistant? Point it at llms.txt or read the guide for AI agents.