Composable runtime primitives for agent task execution, tools, events, state, and recovery.
npm install @devcodex-labs/agent-runtimeimport { createRuntime, defineTool } from '@devcodex-labs/agent-runtime';
const runtime = createRuntime({
tools: [
defineTool({
name: 'uppercase',
execute: (input) => String(input).toUpperCase(),
}),
],
eventSink: (event) => {
console.log(event.type, event.taskId);
},
});
const result = await runtime.run({ type: 'example', input: 'codex' }, (context, task) =>
context.callTool('uppercase', task.input),
);
console.log(result.output);createRuntime(options)creates an agent runtime instance.runtime.run(task, executor)runs one task and emits lifecycle events.defineTool(spec)defines a named tool contract.RuntimeContextexposes task metadata, state, tools, cancellation, and event emission.InMemoryRuntimeStateStoreprovides the first built-in state store.
Releases are tag-driven. A vX.Y.Z tag must match package.json version X.Y.Z; the publish workflow validates that before npm publish --access public.
Apache-2.0