Documentation
Quickstart
Create a shell, write a manifest, push it to Duct, and test the widget. This path is designed for a developer to follow from zero to a working integration.
Commands used in this guide
Each step below maps to one CLI command. Keep the full reference open while you integrate.
Official npm package — CLI, typed manifest helpers, and framework adapters for Node.js 20+.
$ npm i @duct-sdk/sdkPrerequisites
Duct account
A web app or API
Node.js for the CLI
npx, pnpm dlx, or yarn dlx.Login
npx @duct-sdk/sdk login
This stores your Duct API key locally so the CLI can push manifests to your workspace.
Generate A Starter Manifest
npx @duct-sdk/sdk init --manualManual init is the reliable first path. It creates a readable duct.config.tsthat you edit directly. You can later use init, init --update, or init --api-spec / init --curl-collection to import from existing API docs.
Fill In The Manifest
Define the product, user-facing routes, callable actions, auth strategy, and widget behavior.
import { defineDuctConfig } from '@duct-sdk/sdk';
Review every action
Read-only actions can usually beagentAccessible: true with sideEffects: false and sensitivityLevel: low. Mutations, billing, auth, deletion, and high-sensitivity data should stay locked down unless you have a clear consent path. See the Action Permissions for concrete values and runtime behavior.Push To Duct
npx @duct-sdk/sdk push
After push, your hosted shell is available at:
https://shell.ductai.vercel.app/{shellId}Token route — use the /server import on the backend
When wiring the token endpoint in Node.js, Express, Remix loaders, or Next.js API routes, import from@duct-sdk/sdk/server — not the root package. The root export includes React adapters which crash runtimes where React is not installed. import { generateDuctToken } from "@duct-sdk/sdk/server"Wire Middleware And Embed
After init, copy the snippet from .duct/snippets/verify-duct-token.ts into your API auth middleware so proxied action calls authenticate. Then add the generated shell component to your root layout.
'use client';
Verify And Test
Run npx @duct-sdk/sdk checkup to re-run service connectivity checks and the integration audit (token route, receiver, embed, env, deeplinks). Then exercise chat, actions, confirmation, and deeplinks in your app.
npx @duct-sdk/sdk checkup
Test Checklist
- Ask a natural-language question about your product.
- Ask for a read-only data action, such as "show my open orders".
- Try a side-effect action and confirm that Duct asks for confirmation.
- Trigger a deeplink and confirm the receiver route restores state.
- Open dashboard Analytics after signing in; expand a recent session and use Open audit to jump to Conversations with the full turn trace and permission chain.
- Run
npx @duct-sdk/sdk checkupuntil the integration audit has no blocking errors.