The kernel is a single directory — api/src/core/ — with zero npm dependencies and zero imports outside itself (enforced by a purity gate in CI). Vendor it into any Node 24 project (native TypeScript, no build step).
Copy api/src/core into your project, then implement the ports you need:
// 1. copy api/src/core → your project (e.g. ./agent-core)
// 2. implement the ports you need
const myTelemetry: TelemetrySource = {
describe: () => ({ logsAvailable: false, metricsAvailable: true,
metricNames: ['checkout_error_rate'] }),
queryMetrics: async (q) => /* call your time-series store */,
};
// 3. assemble and run const agent = createAgent({ llm: openaiProvider({ baseUrl, apiKey, model }), tools: [staticTools(...telemetryTools(myTelemetry))], store: inMemoryRunStore(), // or your own RunStore system: { role, environment, dataSources, outputFormat }, maxSteps: 12, }); for await (const ev of agent.run({ runId, input, mode: 'read-only' })) { … } ```
Ports you don't implement simply don't exist: a telemetry source without queryLogs produces no query_logs tool — there is no "configured but unavailable" state, and the system prompt reflects reality automatically.
Every run must end through submit_findings — an enforced kernel tool. Text-only endings are nudged back. On submit, the kernel mechanically validates:
evidence: [{ callId, quote }] where callId is a real tool call in this run (use the [evidence:eN] tag printed at the end of every tool result) and quote is a verbatim substring of that result — paraphrased evidence is rejected and retriedruledOut) with reasons — differential diagnosis is a mechanism, not a suggestioninconclusive: true with a reason is legal and encouraged when evidence is thin — confidently-wrong is the most expensive failure modeConsuming the result:
for await (const ev of agent.run({ runId, input })) {
if (ev.type === 'findings') {
// ev.findings.rootCauses[].evidence[] already verified by the kernel —
// render it, gate automation on confidence, ship it to your audit system
}
if (ev.type === 'done') audit.write(ev.outcome.summary, ev.outcome.usage);
}Persist trajectories with block-paired replay and terminal outcomes by implementing RunStore (appendTurn batched, appendOutcome, load). The PG implementation (platform/run-store-pg.ts) is a working reference: legacy-compatible audit columns plus structured blocks JSONB.