* improvement(billing): paginate and parallelize the cycle-close sweep The sweep previously loaded every lagging candidate in one select and closed them serially — correct at any scale (per-subscription guarded marker claims make any interleaving safe) but O(fleet) in memory and wall clock. It now iterates candidates in keyset pages and closes each page with bounded concurrency; a total mapper keeps one failure from rejecting its page, and an interrupted sweep resumes from the durable markers on the next run. The member-lock select gains a deterministic ORDER BY: today member_user_id_unique keeps org rosters disjoint and every other locker is single-row, so no deadlock is currently constructible — the ordering is hygiene that also holds if membership exclusivity is ever relaxed. A partial index on exactly the sweep's candidate predicate (built CONCURRENTLY behind the runner's COMMIT breakpoint) keeps the scan O(lagging) rather than O(fleet); closes shrink it as they land. Validated end-to-end against Stripe test mode: one sweep over 304 staged lagging subscriptions (300 synthetic + 2 multi-member orgs closing concurrently + 2 real test-clock subscriptions with genuine overage) closed 304/304 with failed=0 in 667ms — the same fleet took ~302s serially — while both real subscriptions produced exactly one paid overage invoice each at the expected amounts, with zero invoices for the no-overage fleet. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(billing): restore the runner's lock_timeout and inline entitled statuses for the sweep index The concurrent-index migration now restores lock_timeout='5s' after its post-COMMIT section, matching the runner convention every prior CONCURRENTLY migration follows — without it, later pending files' DDL in the same session would wait indefinitely instead of hitting the runner's 55P03 retry path. The sweep's status filter becomes inlined literals derived from ENTITLED_SUBSCRIPTION_STATUSES: the planner can only prove a query implies a partial index's predicate from literals, and the parameterized generic plan demonstrably seq-scans where the literal form uses subscription_cycle_close_lagging_idx. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
A workspace to build, deploy and manage AI agents and workflows.
Quickstart
Cloud-hosted: sim.ai
Self-hosted
npx sim-setup
Capabilities
- Connect 1,000+ integrations and every major LLM
- Add Slack, Notion, HubSpot, Salesforce, databases, and more
- Build agents visually, conversationally, or with code
- Ingest files, knowledge bases, and structured table data
- Monitor runs, logs, schedules, and workflow activity
One workspace, every surface
Chat and workflows are just the start — tables, files, and knowledge all live in the same workspace.
Tables — a database, built in |
Files — one store for your team and every agent |
Knowledge — your agents' memory |
Self-hosting
Requirements: Node.js 20+ and Docker.
npx sim-setup is an interactive wizard that creates a small sim/ deployment directory, provisions the database, generates secrets, writes .env, connects a Chat API key, and starts the published Sim images with Docker Compose. It does not clone the repository.
When it finishes, open http://localhost:3000.
Inside a cloned Sim repository, run bun run sim-setup to unlock the source-only local development and Kubernetes modes.
Reconfigure an optional capability without rerunning the full wizard:
npx sim-setup config
npx sim-setup add email
npx sim-setup add storage
npx sim-setup add sandbox
npx sim-setup add jobs
npx sim-setup add cache
npx sim-setup add knowledge
npx sim-setup add chat
npx sim-setup add llm
npx sim-setup add integration slack
npx sim-setup config detects the effective local-dev, Docker Compose, or current-context
Helm configuration and reports configured, missing, or invalid capabilities and OAuth
integrations without printing credential values. This is separate from npx sim-setup status,
which reports whether installed services are running and healthy.
Manage your install from its directory:
npx sim-setup start | stop | restart # bring your install up / down / cycle
npx sim-setup update # pull and apply Compose images
npx sim-setup status # what's installed and healthy
npx sim-setup logs # follow logs
npx sim-setup doctor # diagnose configuration problems
npx sim-setup down # remove containers (data kept)
npx sim-setup reset # archive .env and wipe managed data
The setup package detects how you're running and acts accordingly. Use --dir <path> to create or manage a deployment somewhere other than ./sim.
Sim also supports local models via Ollama and vLLM. See the self-hosting docs for details.
Chat API Keys
Chat is a Sim-managed service. npx sim-setup connects a Chat API key for you — sign in when it opens your browser and the key is stored automatically. To view, create, or revoke keys later, go to sim.ai/selfhost/settings/chat-keys.
Environment Variables
See the environment variables reference for the full list, or apps/sim/.env.example for defaults.
Tech Stack
Next.js · Bun · PostgreSQL · Drizzle · Better Auth · Tailwind — and the rest of the stack
- Framework: Next.js (App Router)
- Runtime: Bun
- Database: PostgreSQL with Drizzle ORM
- Authentication: Better Auth
- Schema Validation: Zod
- UI: Shadcn, Tailwind CSS
- Streaming Markdown: Streamdown
- State Management: Zustand, TanStack Query
- Flow Editor: ReactFlow
- Docs: Fumadocs
- Monorepo: Turborepo
- Realtime: Socket.io
- Background Jobs: Trigger.dev
- Remote Code Execution: E2B
- Isolated Code Execution: isolated-vm
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.




