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.
@b4run/sdkto author routes.- The
b4command and runtime entries, including/fetchfor supported edge integrations. @b4run/testingto test programmatically.@b4run/evalsto score behavior.b4:routesfor your app's generated tool and state types.
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.
| Package | Purpose | Audience | Stability | Surfaces | Artifact boundaries | README | Reference | Guide |
|---|---|---|---|---|---|---|---|---|
@b4run/ag-ui | AG-UI protocol translation for B4.run runtimes and web clients. | integration | supported | @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 purityfocused reference · edge-safe runtime · not-claimed purityfocused reference · edge-safe runtime · not-claimed purityfocused reference · edge-safe runtime · not-claimed purityfocused reference · node-only runtime · not-claimed purityfocused reference · browser-only runtime · not-claimed purityfocused reference · browser-only runtime · not-claimed purityfocused reference · browser-only runtime · not-claimed purityfocused reference · browser-only runtime · not-claimed purityfocused reference · edge-safe runtime · not-claimed puritycatalog summary · stylesheet asset; resolved by a bundler, never evaluated as JS · purity n/a | README | Reference | Guide |
@b4run/cli | B4.run development, build, type generation, and runtime commands. | tooling | supported | @b4run/cli@b4run/cli/fetch@b4run/cli/runtime@b4run/cli/testing@b4run/cli/workspacebin.b4 | focused reference · node-only runtime · not-claimed purityfocused reference · edge-safe runtime · not-claimed purityfocused reference · node-only runtime · not-claimed purityfocused reference · node-only runtime · not-claimed purityfocused reference · node-only runtime · not-claimed purityfocused reference · node-only executable command · purity n/a | README | Reference | Guide |
@b4run/config-biome | Shared Biome configuration for B4.run projects. | tooling | supported | @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 | README | Reference | Guide |
@b4run/config-typescript | Shared TypeScript configurations for B4.run projects. | tooling | supported | @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 | README | Reference | Guide |
@b4run/core | Route discovery, app configuration, capabilities, and type generation. | integration | low-level | @b4run/core@b4run/core/node@b4run/core/internal/compiler | focused reference · edge-safe runtime · not-claimed purityfocused reference · node-only runtime · not-claimed purityinternal only · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/devkit | Internal scaffold templates and generated-app test utilities. | internal | internal | @b4run/devkit | internal only · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/evals | Evaluation definitions, scorers, datasets, and runners. | testing | supported | @b4run/evals | focused reference · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/inspector | Browser application for inspecting a running B4.run app. | tooling | supported | b4Inspector.server | catalog summary · node-only separately operated application · purity n/a | README | Reference | Guide |
@b4run/langchain | LangChain backend adapters for B4.run agents and chains. | integration | supported | @b4run/langchain@b4run/langchain/package.json | focused reference · edge-safe runtime · not-claimed purityfocused reference · package metadata; read as data, not runtime code · purity n/a | README | Reference | Guide |
@b4run/langgraph | LangGraph runtime adapters and route contracts. | integration | supported | @b4run/langgraph@b4run/langgraph/define-entry@b4run/langgraph/route-module | focused reference · edge-safe runtime · dependency-free purityfocused reference · edge-safe runtime · dependency-free purityfocused reference · edge-safe runtime · dependency-free purity | README | Reference | Guide |
@b4run/memory | Long-term memory storage, ranking, browsing, and reconciliation. | application | supported | @b4run/memory@b4run/memory/browse@b4run/memory/namespace@b4run/memory/reconcile | focused reference · node-only runtime · not-claimed purityfocused reference · edge-safe runtime · dependency-free purityfocused reference · edge-safe runtime · not-claimed purityfocused reference · edge-safe runtime · not-claimed purity | README | Reference | Guide |
@b4run/memory-pgvector | Postgres and pgvector storage for shared long-term memory. | application | supported | @b4run/memory-pgvector | focused reference · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/permissions | Permission matching and Node-backed approval stores. | integration | supported | @b4run/permissions@b4run/permissions/node | focused reference · edge-safe runtime · not-claimed purityfocused reference · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/postgres-storage | Postgres persistence for checkpoints, threads, and permissions. | application | supported | @b4run/postgres-storage@b4run/postgres-storage/node | focused reference · edge-safe runtime · not-claimed purityfocused reference · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/sandbox | Docker-backed isolated workspace execution for B4.run agents. | application | supported | @b4run/sandbox@b4run/sandbox/testing | focused reference · node-only runtime · not-claimed purityfocused reference · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/sdk | Author-facing declarations for agents, tools, middleware, and routes. | application | supported | @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 purityfocused reference · edge-safe runtime · dependency-free purityfocused reference · node-only runtime · not-claimed purityfocused 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 | README | Reference | Guide |
@b4run/sqlite-storage | Local SQLite persistence for B4.run runtime state. | application | supported | @b4run/sqlite-storage | focused reference · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/testing | Harnesses, fixtures, matchers, and runtime test utilities. | testing | supported | @b4run/testing | focused reference · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/vite-plugin | Internal Vite integration for B4.run type generation. | tooling | internal | @b4run/vite-plugin | internal only · node-only runtime · not-claimed purity | README | Reference | Guide |
@b4run/workspace | Filesystem and shell tools for agent workspaces. | application | supported | @b4run/workspace@b4run/workspace/node | focused reference · edge-safe runtime · dependency-free purityfocused reference · node-only runtime · not-claimed purity | README | Reference | Guide |
create-b4-app | Scaffolder for new B4.run applications. | tooling | supported | bin.create-b4-app | catalog summary · node-only executable command · purity n/a | README | Reference | Guide |
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.