Local Development
Use the Swirls CLI to build, run, and test graphs on your machine before deploying to production.
The Swirls CLI runs a local worker that executes graphs on your machine using SQLite. You write .swirls files, generate types, start the worker, and execute graphs locally. Use the Portal to inspect runs and debug node outputs.
Install the CLI
curl -fsSL https://swirls.ai/install | bashnpm install -g @swirls/cliVerify the install:
swirls --versionLocal development workflow
Install CLI → Login → Create project → Configure → Set env vars → Write graphs → Generate types → Start worker → ExecuteCreate or select a project
Create a new project interactively:
swirls project createTo see existing projects:
swirls project listConfigure the project
Generate a swirls.config.ts in your working directory:
swirls configureThe command prompts for your project ID and writes the config file:
import { defineConfig } from '@swirls/sdk/config'
export default defineConfig({
projectId: '<your-project-id>',
genPath: 'src/swirls.gen.ts',
})The CLI reads swirls.config.ts to determine which project all commands apply to. You can also run swirls config as an alias.
Set environment variables
Set API keys and other secrets your graph nodes need at runtime:
swirls env set OPENAI_API_KEY=sk-...
swirls env set ANOTHER_KEY=valueList all configured variables:
swirls env listRemove a variable:
swirls env remove OPENAI_API_KEYThese variables are available to nodes during local graph execution.
Write .swirls files
Write your graph definitions in .swirls files. See the Swirls Language reference for syntax and available node types.
Generate TypeScript types
Generate TypeScript types and Zod schemas from your project's form definitions:
swirls form genThe CLI writes generated code to the path set in genPath. Import these types in your application to get end-to-end type safety when triggering graphs.
Start the local worker
The worker is a SQLite-backed process that executes graphs on your machine. Start it in the background:
swirls worker startTo keep the process in the foreground (useful for seeing logs directly):
swirls worker start --foregroundCheck worker status or stop it:
swirls worker status
swirls worker stopThe worker must be running for local graph execution to work.
Execute graphs
List available graphs in your project:
swirls graph listExecute a graph by name:
swirls graph execute my-graphPass input as JSON:
swirls graph execute my-graph --input '{"message": "hello"}'After execution, open the Portal to inspect node outputs, trace execution steps, and debug errors.
Additional commands
Storage
Manage files in your project's storage:
swirls storage upload ./file.pdf
swirls storage list
swirls storage download <file-id>
swirls storage delete <file-id>
swirls storage url <file-id>API keys
Create and manage API keys for SDK or API access:
swirls key create
swirls key list
swirls key revoke <key-id>Next steps
- CLI reference — Full reference for all CLI commands.
- Swirls Language — Learn the
.swirlsfile syntax. - Swirls Cloud — Deploy to production.