TypeScript · Bun · Open source

Primitives for building complex agentic systems.

Yoke is the world's best open source agent framework — runtime, actors, event stream, toolchains, tools, agents, inference, and a pluggable store. Stateful by design, provider-agnostic everywhere.

One message type

The chat Message is the inference Message. History feeds straight in; replies are ready to persist.

Agents own the loop

Model calls are stateless. The agent executes its own tools, feeds errors back, and retries.

Typed from registrations

Runtime() accumulates types — ctx.agents and ctx.tools are exactly what you registered.

import { Runtime, inferenceStack, userMessage } from "yoke";
import { openaiProvider } from "@yoke/provider-openai";

const runtime = Runtime({
  inference: inferenceStack({
    providers: [openaiProvider({ apiKey: process.env.OPENAI_API_KEY })],
    models: [{ id: "gpt-4o", provider: "openai", model: "gpt-4o" }],
  }),
})
  .agent({
    name: "assistant",
    initialState: {},
    async run(ctx, input) {
      const reply = await ctx.inference.chat({
        model: "gpt-4o",
        messages: [userMessage(input.text)],
      });
      return { answer: reply.message.content };
    },
  });

await runtime.serve({ port: 3000 });