@agentium/harness package and an Agent execution driver.
The application supplies evidence and a lookup tool. The harness binds them for the run, enforces the model/tool grants and budgets, records events, and cleans up. No web-search service is required.
Download the complete project, extract it, then run npm install and npm run check. Use npm start to execute the recipe with the requirements below.
Set up the project
Use Node.js^22.18.0 or ^24.11.0. In an empty directory:
OPENAI_MODEL to a compatible model your account can use; see model choices.
Run the application
Save this asharness-research.ts:
harness-research.ts
lookup_policy tool event with denied: false, followed by an answer that standard delivery takes 3–5 business days and cites policy:delivery. Wording and the number of model calls can vary.
How the pieces fit
The source catalog is fixture data, but the Agent tool loop is real. Replace
lookup_policy.execute with an authorized application service; preserve the schema, response bounds, and source URI. The function accepts a ModelProvider, so the same application can use another provider or a deterministic test provider.
Adapt and troubleshoot
- No evidence: have the lookup return an explicit missing result; keep the instruction to admit missing evidence.
- Denied tool: compare the tool’s registered name with
grants.toolIds. Per-run grants may narrow this list, never widen it. - Stopped run: inspect
result.statusandresult.reason. Budget exhaustion is a bounded outcome, not permission to retry effects automatically. - Progressive text: configure
agentDriver(config, { stream: true })and consumetext.deltaevents. This recipe observes completed tool events only. - Service endpoint: derive identity from authentication and serialize concurrent runs for one session. See session recipe and authentication.