Skip to main content

Building agents

Most readers first extend the agent they already use: they add a tool, write a Skill or connect an MCP server. Writing your own agent adds the loop, safety and long runs; Codex and Pi come last as complete worked examples. Splitting work across several agents is covered in the coding group, in Multi-Agent Coordination.

Reading Order​

StepArticleYour job
1Harness: Controlling an Agent’s ExecutionSee where execution control, tools, state and verification sit, and where a new capability plugs in.
2Tool Contracts for AI AgentsAdd a tool: define its inputs, authority, side effects and what it returns on failure.
3Bounded Agent LoopsWrite your own loop: step limits, tool validation, result checks and cancellation.
4Agent Security: Prompt Injection, Permissions, Sandboxes, and CredentialsAssume prompt injection sometimes succeeds, and limit its consequences with permissions, approvals, sandboxes and credential isolation.
5Agent SkillsPackage a repeatable procedure as a Skill, and check that it triggers when it should and does the right thing.
6Model Context Protocol (MCP)Connect or write an MCP server: architecture, lifecycle, transports and trust boundaries.
7Long-Running Agents: Checkpoints, Recovery, and IdempotencyLet a task resume after an interruption without repeating side effects on retry.
8Codex Harness Architecture: State, Compaction, Interfaces, and Security BoundariesCase: how Codex handles runtime state, context compaction, integration surfaces and two layers of security control.
9Pi Harness Architecture and Extension BoundariesCase: Pi’s minimal core, customization resources, sessions and extension boundaries.
Explore connectionsOpen network