Yolk SDK
Reference

Architecture

Package boundaries and dependency direction.

Yolk packages are reusable mechanics. Apps provide product policy.

host app / runtime / UI
  -> @yolk-sdk/agent
  -> @yolk-sdk/mcp
  -> @yolk-sdk/knowledge
  -> @yolk-sdk/connectors
  -> @yolk-sdk/sandbox
  -> @yolk-sdk/codemode
  -> @yolk-sdk/extractors
  -> @yolk-sdk/files
  -> @yolk-sdk/pool
  -> @yolk-sdk/vercel-workflows
  -> @yolk-sdk/harness

host tests / fixture scripts
  -> @yolk-sdk/conformance (experimental)
  -> @yolk-sdk/emulators (experimental)

Rules of thumb:

  • packages expose contracts and helpers
  • apps own auth, storage, prompts, providers, enabled tools, approvals, and UI
  • use explicit subpaths
  • keep provider/platform-specific code behind provider/platform subpaths

Dependency direction

  • agent/protocol is the shared wire vocabulary.
  • agent/loop is stateless and provider/tool-service driven.
  • agent/runtime adds generic session orchestration, not app persistence.
  • mcp adapts MCP tools/results to agent protocol, but the loop stays MCP-agnostic.
  • knowledge, connectors, and sandbox expose optional agent adapters behind explicit subpaths.
  • codemode builds on the agent tool contract (callableBy, nested tool access) and depends only on agent among Yolk packages; its root is runtime-neutral, the Node pi executor lives behind codemode/node, and the Dynamic Worker executor behind codemode/cloudflare. agent never imports it.
  • extractors turns uploaded files into bounded text. Its root is runtime-portable (contract, errors, limits, and the FileExtractor tag), the Node parsers live behind extractors/node, and only extractors/knowledge imports knowledge (extractors/knowledge -> knowledge); knowledge never imports it. SheetJS is an optional peer installed from the SheetJS CDN.
  • files builds on the agent tool contract (capture in agent/tools stores FilePart bytes through a host FileStoreApi) and depends only on agent; the sandbox is a structural port that sandbox satisfies, and storage and the upload transport are host ports. agent never imports it.
  • pool wraps several LLMProviders into one and depends only on agent (agent/loop, agent/protocol, agent/providers/subscription-usage); its store is a host port. agent never imports it.
  • vercel-workflows stays generic over serializable unknown payloads and does not import agent protocol.
  • harness owns run lifecycle (claims, inbox, drains). It is not the agent loop and does not add a Workflow driver.
  • conformance (experimental) depends only on effect: it records, replays, and fault-injects HTTP wire fixtures for tests, defines port fixtures for non-HTTP host ports (such as EmailClient), defines conformance cases, and runs them behind a safety policy; it never performs network I/O itself. Provider fixture and case modules such as agent/providers/vercel/conformance import it; runtime code does not.
  • emulators (experimental) depends on effect and never imports other Yolk packages: emulators follow the recorded fixture wire shapes and name the conformance cases behind each route. router swaps HttpClient layers to reach them; email and r2 are plain-JSON fake EmailClient and R2Presigner / R2ObjectClient backends that connectors bridge structurally (connectors never import emulators); only the node, fortnox, microsoft, dropbox, notion, todoist, telegram, github, google, linkedin-search, and mcp subpaths use Node builtins, and only fortnox, microsoft, dropbox, notion, todoist, telegram, github, google, linkedin-search, and mcp use the upstream @emulators/core runtime (pinned exactly).

Strict boundaries let the packages fit many hosts: Next.js, Workers, Durable Objects, Workflows, CLIs, and tests.

On this page