API Reference

This page lists every B4.run package, subpath and executable, and links to its reference. Application code starts with @b4run/sdk. Each focused reference covers a package's exports, defaults, errors and lifecycle rules.

Package and surface indexCopy link to section: Package and surface index

Application shortcuts: most apps only need these surfaces.

In the runtime column, node-only means the surface fails B4.run's edge-safety guard. A node-only surface can still run in a browser. Most node-only entries are server-side, but @b4run/ag-ui/react targets the browser and fails the guard only because React's JSX runtime reads process.env.NODE_ENV. browser-only means the surface needs a bundler: @b4run/ag-ui/react/copilotkit imports CopilotKit, whose bundle imports its own CSS, so plain Node cannot load it, and the @b4run/ag-ui/angular entries ship in Angular's partial compilation format, which an Angular build's linker finishes. Browser bundles only: import them from a bundled React or Angular app, not from Node or an edge runtime.

PackagePurposeAudienceStabilitySurfacesArtifact boundariesREADMEReferenceGuide
@b4run/ag-uiAG-UI protocol translation for B4.run runtimes and web clients.integrationsupported@b4run/ag-ui
@b4run/ag-ui/sse
@b4run/ag-ui/client
@b4run/ag-ui/view
@b4run/ag-ui/react
@b4run/ag-ui/react/copilotkit
@b4run/ag-ui/angular
@b4run/ag-ui/angular/events
@b4run/ag-ui/angular/copilotkit
@b4run/ag-ui/copilotkit-runtime
@b4run/ag-ui/styles.css
focused reference · edge-safe runtime · not-claimed purity
focused reference · edge-safe runtime · not-claimed purity
focused reference · edge-safe runtime · not-claimed purity
focused reference · edge-safe runtime · not-claimed purity
focused reference · node-only runtime · not-claimed purity
focused reference · browser-only runtime · not-claimed purity
focused reference · browser-only runtime · not-claimed purity
focused reference · browser-only runtime · not-claimed purity
focused reference · browser-only runtime · not-claimed purity
focused reference · edge-safe runtime · not-claimed purity
catalog summary · stylesheet asset; resolved by a bundler, never evaluated as JS · purity n/a
READMEReferenceGuide
@b4run/cliB4.run development, build, type generation, and runtime commands.toolingsupported@b4run/cli
@b4run/cli/fetch
@b4run/cli/runtime
@b4run/cli/testing
@b4run/cli/workspace
bin.b4
focused reference · node-only runtime · not-claimed purity
focused reference · edge-safe runtime · not-claimed purity
focused reference · node-only runtime · not-claimed purity
focused reference · node-only runtime · not-claimed purity
focused reference · node-only runtime · not-claimed purity
focused reference · node-only executable command · purity n/a
READMEReferenceGuide
@b4run/config-biomeShared Biome configuration for B4.run projects.toolingsupported@b4run/config-biome
@b4run/config-biome/biome
internal only · static configuration; no runtime import · purity n/a
internal only · static configuration; no runtime import · purity n/a
READMEReferenceGuide
@b4run/config-typescriptShared TypeScript configurations for B4.run projects.toolingsupported@b4run/config-typescript
@b4run/config-typescript/base
@b4run/config-typescript/library
@b4run/config-typescript/node
@b4run/config-typescript/nextjs
internal only · static configuration; no runtime import · purity n/a
internal only · static configuration; no runtime import · purity n/a
internal only · static configuration; no runtime import · purity n/a
internal only · static configuration; no runtime import · purity n/a
internal only · static configuration; no runtime import · purity n/a
READMEReferenceGuide
@b4run/coreRoute discovery, app configuration, capabilities, and type generation.integrationlow-level@b4run/core
@b4run/core/node
@b4run/core/internal/compiler
focused reference · edge-safe runtime · not-claimed purity
focused reference · node-only runtime · not-claimed purity
internal only · node-only runtime · not-claimed purity
READMEReferenceGuide
@b4run/devkitInternal scaffold templates and generated-app test utilities.internalinternal@b4run/devkitinternal only · node-only runtime · not-claimed purityREADMEReferenceGuide
@b4run/evalsEvaluation definitions, scorers, datasets, and runners.testingsupported@b4run/evalsfocused reference · node-only runtime · not-claimed purityREADMEReferenceGuide
@b4run/inspectorBrowser application for inspecting a running B4.run app.toolingsupportedb4Inspector.servercatalog summary · node-only separately operated application · purity n/aREADMEReferenceGuide
@b4run/langchainLangChain backend adapters for B4.run agents and chains.integrationsupported@b4run/langchain
@b4run/langchain/package.json
focused reference · edge-safe runtime · not-claimed purity
focused reference · package metadata; read as data, not runtime code · purity n/a
READMEReferenceGuide
@b4run/langgraphLangGraph runtime adapters and route contracts.integrationsupported@b4run/langgraph
@b4run/langgraph/define-entry
@b4run/langgraph/route-module
focused reference · edge-safe runtime · dependency-free purity
focused reference · edge-safe runtime · dependency-free purity
focused reference · edge-safe runtime · dependency-free purity
READMEReferenceGuide
@b4run/memoryLong-term memory storage, ranking, browsing, and reconciliation.applicationsupported@b4run/memory
@b4run/memory/browse
@b4run/memory/namespace
@b4run/memory/reconcile
focused reference · node-only runtime · not-claimed purity
focused reference · edge-safe runtime · dependency-free purity
focused reference · edge-safe runtime · not-claimed purity
focused reference · edge-safe runtime · not-claimed purity
READMEReferenceGuide
@b4run/memory-pgvectorPostgres and pgvector storage for shared long-term memory.applicationsupported@b4run/memory-pgvectorfocused reference · node-only runtime · not-claimed purityREADMEReferenceGuide
@b4run/permissionsPermission matching and Node-backed approval stores.integrationsupported@b4run/permissions
@b4run/permissions/node
focused reference · edge-safe runtime · not-claimed purity
focused reference · node-only runtime · not-claimed purity
READMEReferenceGuide
@b4run/postgres-storagePostgres persistence for checkpoints, threads, and permissions.applicationsupported@b4run/postgres-storage
@b4run/postgres-storage/node
focused reference · edge-safe runtime · not-claimed purity
focused reference · node-only runtime · not-claimed purity
READMEReferenceGuide
@b4run/sandboxDocker-backed isolated workspace execution for B4.run agents.applicationsupported@b4run/sandbox
@b4run/sandbox/testing
focused reference · node-only runtime · not-claimed purity
focused reference · node-only runtime · not-claimed purity
READMEReferenceGuide
@b4run/sdkAuthor-facing declarations for agents, tools, middleware, and routes.applicationsupported@b4run/sdk
@b4run/sdk/pure
@b4run/sdk/testing
@b4run/sdk/tool-step.schema.json
@b4run/sdk/answer.schema.json
focused reference · edge-safe runtime · not-claimed purity
focused reference · edge-safe runtime · dependency-free purity
focused reference · node-only runtime · not-claimed purity
focused reference · package metadata; read as data, not runtime code · purity n/a
focused reference · package metadata; read as data, not runtime code · purity n/a
READMEReferenceGuide
@b4run/sqlite-storageLocal SQLite persistence for B4.run runtime state.applicationsupported@b4run/sqlite-storagefocused reference · node-only runtime · not-claimed purityREADMEReferenceGuide
@b4run/testingHarnesses, fixtures, matchers, and runtime test utilities.testingsupported@b4run/testingfocused reference · node-only runtime · not-claimed purityREADMEReferenceGuide
@b4run/vite-pluginInternal Vite integration for B4.run type generation.toolinginternal@b4run/vite-plugininternal only · node-only runtime · not-claimed purityREADMEReferenceGuide
@b4run/workspaceFilesystem and shell tools for agent workspaces.applicationsupported@b4run/workspace
@b4run/workspace/node
focused reference · edge-safe runtime · dependency-free purity
focused reference · node-only runtime · not-claimed purity
READMEReferenceGuide
create-b4-appScaffolder for new B4.run applications.toolingsupportedbin.create-b4-appcatalog summary · node-only executable command · purity n/aREADMEReferenceGuide

Generated surface: b4:routes (focused reference · generated types; compile-time only, no runtime import · purity n/a).

Reference conventionsCopy link to section: Reference conventions

  • Audience says who should import a surface: application code, integration code, tests, tooling, or B4.run internals.
  • Stability separates supported APIs from low-level or internal ones.
  • Artifact boundaries says whether each surface has a focused reference, a catalog summary, or is internal only. It also says whether the surface is runtime code, static configuration, metadata, generated types, a command, or a separately operated application. Runtime imports state their purity claim too.

The headings below keep links from the old single-page reference working. Each one points to the page and section that now documents it. Use that link in new docs.

@b4run/sdkCopy link to section: @b4run/sdk

The application authoring surface lives at @b4run/sdk.

AgentCopy link to section: Agent

See the canonical agent() and AgentConfig contract.

agent(config)Copy link to section: agent(config)

See the canonical agent() signature.

AgentConfigCopy link to section: AgentConfig

See the canonical AgentConfig fields.

ReasoningConfigCopy link to section: ReasoningConfig

See the canonical agent configuration contract.

RetryConfigCopy link to section: RetryConfig

See the canonical agent configuration contract.

B4AgentCopy link to section: B4Agent

See the canonical agent descriptor contract.

Subagent delegation typesCopy link to section: Subagent delegation types

See the canonical SDK public export inventory.

isB4Agent(value)Copy link to section: isB4Agent(value)

See the canonical agent descriptor contract.

MiddlewareCopy link to section: Middleware

See the canonical middleware result contract.

defineMiddleware(fn)Copy link to section: defineMiddleware(fn)

See the canonical middleware export inventory.

allow(context?)Copy link to section: allow(context?)

See the canonical allow() and reject() contract.

reject(status, body?)Copy link to section: reject(status, body?)

See the canonical allow() and reject() contract.

B4MiddlewareCopy link to section: B4Middleware

See the canonical middleware export inventory.

MiddlewareRequestCopy link to section: MiddlewareRequest

See the canonical middleware export inventory.

MiddlewareResultCopy link to section: MiddlewareResult

See the canonical middleware result contract.

ContinueResultCopy link to section: ContinueResult

See the canonical middleware result contract.

RejectResultCopy link to section: RejectResult

See the canonical middleware result contract.

MemoryCopy link to section: Memory

See the canonical SDK public export inventory and the long-term memory guide.

defineMemory(def)Copy link to section: defineMemory(def)

See the canonical SDK public export inventory.

DefinedMemoryCopy link to section: DefinedMemory

See the canonical SDK public export inventory.

MemoryScopeDimensionCopy link to section: MemoryScopeDimension

See the canonical SDK public export inventory.

Route configurationCopy link to section: Route configuration

See the canonical RouteConfig contract.

RouteConfigCopy link to section: RouteConfig

See the canonical RouteConfig contract.

RouteKindCopy link to section: RouteKind

See the canonical RouteConfig contract.

Route typesCopy link to section: Route types

See the canonical SDK public export inventory.

RouteStateMapCopy link to section: RouteStateMap

See the canonical SDK public export inventory.

RouteToolMapCopy link to section: RouteToolMap

See the canonical SDK public export inventory.

RuntimeCopy link to section: Runtime

See the canonical SDK public export inventory.

RuntimeContext<Tools>Copy link to section: RuntimeContext<Tools>

See the canonical RuntimeContext export.

RuntimeToolCopy link to section: RuntimeTool

See the canonical SDK public export inventory.

ToolRegistryCopy link to section: ToolRegistry

See the canonical SDK public export inventory.

B4ToolContextCopy link to section: B4ToolContext

See the canonical SDK public export inventory.

WorkspaceFsCopy link to section: WorkspaceFs

See the canonical SDK public export inventory.

ModelsCopy link to section: Models

See the canonical model validation contract.

KnownModelIdCopy link to section: KnownModelId

See the canonical SDK model export inventory.

ModelProviderIdCopy link to section: ModelProviderId

See the canonical SDK model export inventory.

OpenAiModelIdCopy link to section: OpenAiModelId

See the canonical SDK model export inventory.

GoogleModelIdCopy link to section: GoogleModelId

See the canonical SDK model export inventory.

AnthropicModelIdCopy link to section: AnthropicModelId

See the canonical SDK model export inventory.

XaiModelIdCopy link to section: XaiModelId

See the canonical SDK model export inventory.

inferProvider(model)Copy link to section: inferProvider(model)

See the canonical model validation contract.

SUPPORTED_AGENT_PROVIDERSCopy link to section: SUPPORTED_AGENT_PROVIDERS

See the canonical SDK model export inventory.

validateModelId(opts)Copy link to section: validateModelId(opts)

See the canonical validateModelId() contract.

ModelIdValidationCopy link to section: ModelIdValidation

See the canonical validateModelId() contract.

Model id constantsCopy link to section: Model id constants

See the canonical SDK model export inventory.

Backend adapterCopy link to section: Backend adapter

See the canonical SDK public export inventory.

BackendAdapterCopy link to section: BackendAdapter

See the canonical SDK public export inventory.

UtilitiesCopy link to section: Utilities

See the canonical SDK public export inventory.

Prettify<T>Copy link to section: Prettify<T>

See the canonical SDK public export inventory.

@b4run/cliCopy link to section: @b4run/cli

The command and embedding surfaces now live at @b4run/cli.

serveRuntime(options)Copy link to section: serveRuntime(options)

See the canonical serveRuntime() contract.

loadStaticModules(manifestUrl)Copy link to section: loadStaticModules(manifestUrl)

See the canonical CLI public export inventory.

B4StaticModules and StaticRouteModuleCopy link to section: B4StaticModules and StaticRouteModule

See the canonical CLI root export inventory.

@b4run/cli/fetchCopy link to section: @b4run/cli/fetch

See the canonical edge-safe fetch subpath.

@b4run/cli/runtimeCopy link to section: @b4run/cli/runtime

See the canonical low-level runtime subpath.

@b4run/coreCopy link to section: @b4run/core

The integration surface lives at @b4run/core.

Capability exportsCopy link to section: Capability exports

See the canonical Core public export inventory.

createCapabilityRegistry(markers) and applyCapabilities()Copy link to section: createCapabilityRegistry(markers) and applyCapabilities()

See the canonical Core public export inventory.

gateToolOp() and wrapToolWithApproval()Copy link to section: gateToolOp() and wrapToolWithApproval()

See the canonical Core public export inventory.

createWorkspaceFs(options)Copy link to section: createWorkspaceFs(options)

See the canonical Core public export inventory.

loadB4Config(options) and config(value)Copy link to section: loadB4Config(options) and config(value)

See the canonical loadB4Config() contract.

discoverRoutes(options), findB4App(options), and route segmentsCopy link to section: discoverRoutes(options), findB4App(options), and route segments

See the canonical Core public export inventory.

State and typegen helpersCopy link to section: State and typegen helpers

See the canonical resolveStateFields() contract.

Tool scopeCopy link to section: Tool scope

See the canonical Core public export inventory.

Storage type re-exportCopy link to section: Storage type re-export

See the canonical Core public export inventory.

@b4run/ag-uiCopy link to section: @b4run/ag-ui

The AG-UI adapter surface lives at @b4run/ag-ui.

ID factoriesCopy link to section: ID factories

See the canonical AG-UI public export inventory.

toAguiEvents(chunks, context)Copy link to section: toAguiEvents(chunks, context)

See the canonical inbound and outbound contracts.

fromRunAgentInput(input)Copy link to section: fromRunAgentInput(input)

See the canonical inbound and outbound contracts.

SSE subpath: encodeAgUiSse(event, accept?)Copy link to section: SSE subpath: encodeAgUiSse(event, accept?)

encodeAgUiSse was replaced by encodeAgUiEvent(event, accept?) and agUiContentType(accept?). See the canonical SSE subpath inventory.

@b4run/memoryCopy link to section: @b4run/memory

The long-term memory package surface lives at @b4run/memory.

MemoryStoreCopy link to section: MemoryStore

See the canonical store and query shapes.

MemoryRecordCopy link to section: MemoryRecord

See the canonical store and query shapes.

MemoryQueryCopy link to section: MemoryQuery

See the canonical store and query shapes.

BrowseQuery, BrowsePage, and MemoryStatsCopy link to section: BrowseQuery, BrowsePage, and MemoryStats

See the canonical browse subpath inventory.

@b4run/memory/browseCopy link to section: @b4run/memory/browse

See the canonical browse subpath inventory.

@b4run/memory-pgvectorCopy link to section: @b4run/memory-pgvector

The shared memory backend lives at @b4run/memory-pgvector.

pgvectorMemoryStore(options)Copy link to section: pgvectorMemoryStore(options)

See the canonical PgvectorMemoryStore contract.

PgvectorMemoryStoreCopy link to section: PgvectorMemoryStore

See the canonical PgvectorMemoryStore contract.

vectorColumnDef(dimensions)Copy link to section: vectorColumnDef(dimensions)

See the canonical dimension branches contract.

initSchema(client, options)Copy link to section: initSchema(client, options)

See the canonical initialization contract.

assertIdentifier(name, value)Copy link to section: assertIdentifier(name, value)

See the canonical schema identifier contract.

@b4run/postgres-storageCopy link to section: @b4run/postgres-storage

The durable runtime storage surface lives at @b4run/postgres-storage.

PostgresStoreOptionsCopy link to section: PostgresStoreOptions

See the canonical PostgresStoreOptions fields.

@b4run/postgres-storage/nodeCopy link to section: @b4run/postgres-storage/node

See the canonical Node subpath inventory.

postgresCheckpointer(options)Copy link to section: postgresCheckpointer(options)

See the canonical Postgres root export inventory.

createPostgresThreadsStore(options)Copy link to section: createPostgresThreadsStore(options)

See the canonical Postgres root export inventory.

createPostgresPermissionsStore(options)Copy link to section: createPostgresPermissionsStore(options)

See the canonical Postgres root export inventory.

assertIdentifier(name, value)Copy link to section: assertIdentifier(name, value)

See the canonical Postgres root export inventory.

DEFAULT_SCHEMA / DEFAULT_TABLE_PREFIXCopy link to section: DEFAULT_SCHEMA / DEFAULT_TABLE_PREFIX

See the canonical Postgres root export inventory.

@b4run/testingCopy link to section: @b4run/testing

The programmatic test surface lives at @b4run/testing. For fixture workflows, see Fixtures and Recording.

HarnessesCopy link to section: Harnesses

See the canonical harness options contract.

Aimock fixtures and recordingCopy link to section: Aimock fixtures and recording

See the canonical harness and fixture lifecycle.

MatchersCopy link to section: Matchers

See the canonical testing public export inventory.

Run-result utilitiesCopy link to section: Run-result utilities

See the canonical testing public export inventory.

Memory, protocol, and subprocess helpersCopy link to section: Memory, protocol, and subprocess helpers

See the canonical harness and fixture lifecycle.

ExampleCopy link to section: Example

See the canonical testing examples.

@b4run/evalsCopy link to section: @b4run/evals

The evaluation surface lives at @b4run/evals.

Eval definition and executionCopy link to section: Eval definition and execution

See the canonical EvalDefinition contract.

Scores and gatesCopy link to section: Scores and gates

See the canonical evaluation semantics.

Built-in scorersCopy link to section: Built-in scorers

See the canonical eval public export inventory.

Memory scorersCopy link to section: Memory scorers

See the canonical eval public export inventory.

ExampleCopy link to section: Example

See the canonical eval examples.

b4:routes (generated)Copy link to section: b4:routes (generated)

The generated application types now live at b4:routes.

RouteTools<P>Copy link to section: RouteTools<P>

See the canonical generated tool contract.

RouteState<P>Copy link to section: RouteState<P>

See the canonical generated state contract.

Where to read moreCopy link to section: Where to read more

Start with Agents, Routes, and Tools. The package references above cover each import, field, default, error, and lifecycle rule.