Extract the reusable execution core
The agent loop consumes a tool-runtime contract. Model calls and run events stay in the library, while product toolsets and permissions remain in the host application.
Composable execution primitives for AI applications
A public TypeScript library for agent runs, tools, context, memory, retrieval, guardrails and sub-agents. Host applications provide models, tools, identity and product policy.
An agent application needs more than a model loop. Tool effects, approvals, context limits, cancellation and records must be composed without forcing every product to inherit the same business rules or entry point.
Public library · Product decisions stay in the host
The library exposes runtime modules and protocol contracts. Applications supply their own models, prompts, concrete tools, authorization, storage and transport; the diagram is not a standalone hosted service.
The agent loop consumes a tool-runtime contract. Model calls and run events stay in the library, while product toolsets and permissions remain in the host application.
Guarded execution can buffer generated events while input checks run. Tool execution waits for the input-effect gate; a rejected run discards buffered output instead of presenting it as completed work.
A versioned package asset, public entry points and a deterministic example let another application inspect and integrate the library without assuming it contains a CLI or product server.
Run cancellation propagates through execution. Session, trace and guardrail code distinguish interrupted or rejected work from success.
The host owns identity, tenant isolation, credentials, approvals and concrete tools. Runtime guardrails do not replace those authorization boundaries.
The repository provides tests, coverage and a deterministic example. Those checks do not establish live-provider quality or production operation for a consuming product.
Source links are pinned to the reviewed revision so you can follow each implementation detail.
Run events, model steps, cancellation and tool-runtime composition.
src/harness/agent/loop.tsArgument validation, permissions, approvals and outcomes.
src/tools/execution-pipeline.tsBuffered checks, effect gating and recovery handling.
src/harness/guardrails/runner.tsA runnable model-free integration example.
examples/basic-agent.mjsInspect behavioral tests; this link does not assert the latest CI run passed.
src/harness/agent/loop.spec.tsPublic source and a v0.4.0 GitHub Release are available. This is a library, not a hosted application or a drop-in replacement for the archived coding-agent application.