Skip to content

Repository files navigation

agent-runtime

Composable runtime primitives for agent task execution, tools, events, state, and recovery.

Install

npm install @devcodex-labs/agent-runtime

Quick Start

import { 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);

Runtime Surface

  • 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.
  • RuntimeContext exposes task metadata, state, tools, cancellation, and event emission.
  • InMemoryRuntimeStateStore provides the first built-in state store.

Release

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.

License

Apache-2.0

About

Composable runtime primitives for agent task execution, tools, events, state, and recovery.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages