Getting Started
SurfaceWeave converts a registered Tool Definition into a serializable Surface. The host renders that Surface, receives ActionIntent, and decides whether to execute the Tool. SurfaceWeave does not call business APIs or run workflows.
Requirements
- Node.js 22.13 or newer
- TypeScript with strict mode recommended
- React 18 or 19 only when using
@surfaceweave/react
Install the runtime
Install only the layers your host needs:
bash
npm install @surfaceweave/core@next \
@surfaceweave/generator@next \
@surfaceweave/agent-tools@nextCreate a Tool surface
ts
import { ToolToUIRuntime } from "@surfaceweave/agent-tools";
import {
InMemorySurfaceStore,
createStandardComponentRegistry,
} from "@surfaceweave/core";
const components = createStandardComponentRegistry();
const surfaces = new InMemorySurfaceStore(components);
const runtime = new ToolToUIRuntime(components, surfaces);
runtime.registerTool({
id: "orders.create",
version: "1.0.0",
inputSchema: {
type: "object",
required: ["buyer"],
properties: { buyer: { type: "string", title: "Buyer" } },
},
outputSchema: {
type: "object",
properties: { orderId: { type: "string" } },
},
annotations: {
sideEffect: true,
confirmation: "required",
retry: "safe",
},
});
const { invocation, surface } = runtime.createToolSurface({
toolId: "orders.create",
surfaceId: "order-form",
initialValues: { buyer: "Ada" },
});surface can cross a JSON boundary. invocation correlates later requests, loading state, errors, results, and replacement Surfaces.
Next steps
- Connect the Tool-to-UI lifecycle.
- Review the current OpenAPI-to-form boundary.
- Render the Surface with React.
- Select an optional Component Pack.
- Try the conversation playground or the operations center flow, both in
examples/operations-center. The originalexamples/tea-purchaseremains the OpenAPI and multi-pack acceptance baseline.