The agent runs one AI pipeline against a project. It takes resolved data in, reports through progress events, asks through an answerer you pass, and returns a result. It never reads a session, a store or a UI.
To call it from code, use runAgent. The
developer interfaces cover it.
- In. A
RunConfigwith the caller's routing, aRunInput, and callbacks for progress and questions. - Out. One
RunResultat the end. - Never in. A session, a store or the UI.
| What | Where |
|---|---|
| The entry points | index.ts and types.ts |
| The run types: config, input and result | shared/types.ts |
| Progress events and the answerer | progress.ts |
| Sequences, harnesses and route resolution | runner |
| The wizard tools both harnesses share | tools |
| The benchmark pipeline | middleware |
| YARA scans of tool calls (Pre/PostToolUse) and of installed skills | yara-hooks.ts |
Import runtime values from @agent and types from @agent/types. @agent
exports runAgent, RunOutcome (from @shared/run-state, so the hosts read it
without the agent), AgentSignals, WIZARD_TOOL_NAMES, DEFAULT_BINDING,
scanVerdict, scanInstalledSkill and streamMcpPrompt, the MCP tutorial's
prompt stream. pnpm lint rejects a deeper import from any other layer, through
ESLint no-restricted-syntax. Files inside src/agent import each other by
relative path. Nothing enforces this: the agent's project maps @agent,
@agent/types and @agent/* through tsconfig.no-tui.json, and its tests use
them. The agent itself may import @env, @shared/* and @utils/*, and
nothing else; see
layer boundaries.
tools/mcp.ts lists the wizard tools, and
tools/tools.ts implements them. Pi registers the same tools
in harness/pi/tools.ts, and reaches the PostHog
MCP server through harness/pi/mcp.ts.