Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
# Service Ports — serial non-standard block starting at 5678 so
# OpenCompany never collides with common dev servers (3000/8080/etc.):
# 5678 THE APP (always — uvicorn serving API + WS + SPA in production;
# the Vite dev server in dev, proxying backend prefixes),
# 5679 backend uvicorn in dev, behind the Vite proxy (.env.dev),
# 5680 Temporal Web UI, 5681 Temporal gRPC,
# 5682 JS/TS executor sidecar (runs on bun), 5683 WhatsApp RPC.
VITE_CLIENT_PORT=5678
PYTHON_BACKEND_PORT=5678
# Plugin-owned (read by nodes/code/, not core Settings). Related
# optional vars: NODEJS_EXECUTOR_URL (external executor override),
# NODEJS_EXECUTOR_TIMEOUT.
NODEJS_EXECUTOR_PORT=5682
# Plugin-owned (read by nodes/whatsapp/, not core Settings). Related
# optional vars: WHATSAPP_RUNTIME_ENABLED, WHATSAPP_DATA_SUBDIR,
# WHATSAPP_BINARY_PATH, WHATSAPP_BIND_HOST, WHATSAPP_RPC_URL.
WHATSAPP_RPC_PORT=5683
REDIS_PORT=6379
# Server Configuration
HOST=127.0.0.1
PORT=5678
DEBUG=false
WORKERS=1
# Security (Development keys - MUST CHANGE FOR PRODUCTION)
# These two keys and JWT_SECRET_KEY below are public placeholders.
# Replace each with the output of
# python -c "import secrets; print(secrets.token_hex(24))"
# before storing any credentials, and never change API_KEY_ENCRYPTION_KEY
# after that: stored credentials are encrypted with it.
SECRET_KEY=dev-secret-key-12345678901234567890123456789012
API_KEY_ENCRYPTION_KEY=dev-encryption-key-12345678901234567890123456
# Authentication
# VITE_AUTH_ENABLED: "true" (require login) or "false" (bypass authentication)
VITE_AUTH_ENABLED=false
# AUTH_MODE: "single" (local deploy - first user is owner) or "multi" (cloud - open registration)
AUTH_MODE=single
JWT_SECRET_KEY=dev-jwt-secret-key-12345678901234567890
JWT_EXPIRE_MINUTES=10080
JWT_COOKIE_NAME=opencompany_token
JWT_COOKIE_SECURE=false
# JWT_COOKIE_SAMESITE: "lax" | "strict" | "none". "none" REQUIRES
# JWT_COOKIE_SECURE=true (browsers reject an insecure SameSite=None cookie,
# which silently breaks login) — the combination is rejected at startup.
JWT_COOKIE_SAMESITE=lax
# Login/registration throttling. Deliberately tighter than RATE_LIMIT_* below,
# which is a generic API budget and far too loose for a password endpoint.
# Counters are per-process: exact under `company serve` (one uvicorn worker),
# best-effort under the legacy multi-worker gunicorn path.
AUTH_RATE_LIMIT_ENABLED=true
AUTH_RATE_LIMIT_ATTEMPTS=10
AUTH_RATE_LIMIT_WINDOW=300
# CORS Configuration - the app port, the Vite dev client, and Vite's
# bare default (5173) for ad-hoc runs
CORS_ORIGINS=["http://localhost:5678","http://localhost:5679","http://127.0.0.1:5678","http://127.0.0.1:5679","http://localhost:5173"]
# Database Configuration
# SQLite DB filename. Resolved under DATA_DIR by
# ``Settings._resolve_under_data`` — same pattern as ``temporal.db``
# and ``credentials.db`` so dev mode's DATA_DIR=.opencompany moves all
# three together. The SQLAlchemy URL is composed at runtime by
# ``Settings.database_url`` (sqlite+aiosqlite:///<abspath>).
WORKFLOW_DB_FILENAME=workflow.db
DATABASE_ECHO=false
DATABASE_POOL_SIZE=5
DATABASE_MAX_OVERFLOW=10
# Cache Configuration (Disabled for development)
REDIS_ENABLED=false
CACHE_TTL=300
# Temporal Configuration
# Enable for durable workflow execution with automatic retries.
# Backed by ``temporal server start-dev`` against a SQLite db at
# ``TEMPORAL_SQLITE_PATH``. The official ``temporal`` CLI release pinned
# in server/config/temporal_cli.json is downloaded by pooch on
# ``company build`` (or first ``company start`` if build was skipped).
# A database another server minor created is deleted at start.
TEMPORAL_ENABLED=true
EMPLOYEE_TEAMS_ENABLED=true
EMPLOYEE_CAPABILITY_UPDATES_ENABLED=true
EMPLOYEE_SAFE_APPLY_ENABLED=true
EMPLOYEE_TEAM_CONVERSION_ENABLED=false
TEMPORAL_SERVER_ADDRESS=localhost:5681
TEMPORAL_NAMESPACE=default
# Durable Temporal wire identifier retained so upgrades can resume in-flight
# workflows. New display/package identifiers use OpenCompany.
TEMPORAL_TASK_QUEUE=machina-tasks
TEMPORAL_PER_TYPE_DISPATCH=true
TEMPORAL_AGENT_WORKFLOW_ENABLED=true
# New Coding Agent invocations use Pi and require Temporal regardless of the
# general agent-workflow flag. Disable admissions during a staged rollout;
# existing native generations and admitted Pi runs retain their runtime.
CODING_PI_ADMISSIONS_ENABLED=true
# Private driver slots: local=1, cloud/self-hosted=2. Positive override only.
# TEMPORAL_CODING_PI_DRIVER_CONCURRENCY=1
# Per-queue activity routing (Wave 16, default-on since 16.4). A
# TemporalWorkerPool starts one activity-only Worker per plugin-declared
# task queue (ai-heavy / browser / code-exec / rest-api / messaging /
# ...) and per-type activities route to their specialised queue instead
# of the single 100-slot pool on machina-tasks. Rollback channel: set
# false + restart — activities route back to the manager worker
# unchanged.
TEMPORAL_WORKER_POOL_ENABLED=true
# Distributed browser setup: docs-internal/browser_agent_deployment.md.
# Owner queues remain mandatory when the generic worker pool is disabled.
DISTRIBUTED_MODE=false
# DATABASE_URL=postgresql+asyncpg://opencompany:...@database:5432/opencompany
# BROWSER_REPLICA_ID=backend-a
# BROWSER_REPLICA_URL=http://backend-a:5678
# Stable physical machine identity across container restarts:
# BROWSER_MACHINE_ID=machine-a
# Shared forwarding secret (defaults to SECRET_KEY):
# BROWSER_ROUTER_SECRET=...
ONEPASSWORD_CLI_VERSION=2.40.0
ONEPASSWORD_AUTH_MODE=desktop
# ONEPASSWORD_CLI_PATH=/absolute/path/to/op
# ONEPASSWORD_ACCOUNT=account.1password.com
ONEPASSWORD_READ_TIMEOUT_SECONDS=30
# Distributed mode requires ONEPASSWORD_AUTH_MODE=service_account.
# Inject OP_SERVICE_ACCOUNT_TOKEN using trusted deployment secret configuration.
# Never put it in node parameters, graph JSON or serialized Settings.
# Deployment topology hint: local (dev laptop; sleeps; halved per-queue
# concurrency) | cloud (company deploy VM) | self_hosted. Drives worker
# identity strings in the Temporal Web UI and per-mode concurrency
# defaults. Explicit TEMPORAL_<QUEUE>_CONCURRENCY overrides always win.
DEPLOYMENT_MODE=local
# Per-queue concurrency overrides for the worker pool. Cloud defaults:
# machina-default=20, rest-api=50, ai-heavy=4, code-exec=10,
# triggers-poll=100, triggers-event=100, android=10, browser=4,
# messaging=20 (DEPLOYMENT_MODE=local halves these, floor 1).
# Examples:
# 4-core laptop: TEMPORAL_AI_HEAVY_CONCURRENCY=2 TEMPORAL_BROWSER_CONCURRENCY=2 TEMPORAL_CODE_EXEC_CONCURRENCY=4
# 32-core cloud: TEMPORAL_AI_HEAVY_CONCURRENCY=16 TEMPORAL_BROWSER_CONCURRENCY=8 TEMPORAL_CODE_EXEC_CONCURRENCY=32
# gRPC frontend port the dev server binds (``--port``) — part of the
# 5678-based serial port block (Temporal's own default is 7233).
TEMPORAL_FRONTEND_GRPC_PORT=5681
# Web UI port (``--ui-port``). ``temporal server start-dev`` defaults
# this to ``--port + 1000``; pinned into the serial port block instead.
# Browse to http://<host>:<TEMPORAL_UI_PORT>/.
TEMPORAL_UI_PORT=5680
# SQLite db file ``temporal server start-dev --db-filename`` opens.
# Relative to DATA_DIR (= ~/.opencompany/) unless absolute. Flat under
# DATA_DIR like ``credentials.db`` / ``workflow.db``. History is
# always preserved across restarts (Temporal UI keeps showing every
# workflow that ever ran); see ``TEMPORAL_TERMINATE_RUNNING_ON_STARTUP``
# below for the resumption knob.
TEMPORAL_SQLITE_PATH=temporal.db
# On server boot, terminate every workflow still in ``Running`` state.
# History is preserved (workflows show as ``Terminated`` in the UI,
# NOT deleted) but the live executions stop. Durable workflow-control
# generations reconcile active Temporal executions on boot, so keep
# false — running and paused deployments must survive an application
# restart and keep executing for months. Setting true is a debug-only
# escape hatch that converts every boot into a namespace-wide sweep.
TEMPORAL_TERMINATE_RUNNING_ON_STARTUP=false
# Graceful shutdown window for the Temporal child process.
TEMPORAL_GRACEFUL_SHUTDOWN_SECONDS=30
# Backend-owned dev-server health monitor: after startup the lifespan
# keeps probing the Temporal dev server at this interval and respawns
# it if the child process dies while the backend stays up. Loopback
# (backend-owned) servers only; remote clusters are never touched.
TEMPORAL_HEALTH_MONITOR_INTERVAL_SECONDS=15
# --- Workflow-control recovery policies ---
# Posture for deployments still ``running`` after an UNCLEAN shutdown
# (kill / crash, detected via a dirty-bit marker the graceful lifespan
# teardown clears). ``pause`` recovers them paused so the user
# consciously resumes; ``resume`` restores them running. A clean
# ``company stop`` + start always restores deployments as they were.
WORKFLOW_CONTROL_CRASH_RECOVERY=pause
# Convergence for a live generation whose controller execution vanished
# (terminated in the Temporal UI, killed, retention-deleted). ``pause``
# keeps it user-resumable — Resume rebuilds the controller from the
# durable row + graph snapshot; ``fail`` preserves the legacy behaviour
# where only Reset (which archives conversation state) recovers.
WORKFLOW_CONTROL_MISSING_CONTROLLER=pause
# Circuit breaker: when controlled runs keep failing, pause the
# deployment (fix + Resume) instead of letting the trigger keep firing
# into the same error indefinitely. ``false`` disables the auto-pause.
WORKFLOW_CONTROL_PAUSE_ON_FAILURE=true
# The breaker trips only after this many failed runs inside the rolling
# window below — one node hiccup on one firing (missing config,
# transient API error) never pauses a deployment. Resume resets the
# count; ``1`` restores pause-on-the-first-failure.
WORKFLOW_CONTROL_PAUSE_ON_FAILURE_THRESHOLD=3
WORKFLOW_CONTROL_PAUSE_ON_FAILURE_WINDOW_SECONDS=600
# --- Startup resilience (server-ready-before-workers) ---
# After the gRPC port binds, the client polls the WorkflowService gRPC
# health check until it reports SERVING before starting the worker /
# visibility sweep (the documented readiness probe; see
# https://docs.temporal.io/troubleshooting/deadline-exceeded-error).
# Bounded — the unbounded layer is main.py's 3s reconnect loop.
TEMPORAL_HEALTH_CHECK_ATTEMPTS=5
TEMPORAL_HEALTH_CHECK_DELAY_SECONDS=0.5
TEMPORAL_HEALTH_CHECK_TIMEOUT_SECONDS=2.0
# The boot-time terminate-running sweep issues a Visibility query that
# races shard acquisition ("shard status unknown"). Retry it a few times
# (linear backoff = attempt x base) before giving up for that boot.
TEMPORAL_SWEEP_ATTEMPTS=4
TEMPORAL_SWEEP_BACKOFF_SECONDS=0.5
# The embedded worker self-restarts on a transient crash (the Temporal
# worker shuts down on a poll failure rather than auto-retrying). Backoff
# doubles from base up to max between restarts.
TEMPORAL_WORKER_RESTART_BACKOFF_SECONDS=1.0
TEMPORAL_WORKER_RESTART_BACKOFF_MAX_SECONDS=30.0
# Wave 12 event framework. ``true`` (default) routes trigger events
# through TriggerListenerWorkflow + Temporal Signal fan-out for the
# 8 canary-registered trigger types (webhook, chat, task, telegram,
# whatsapp, gmail, cron, email). Flip to ``false`` to roll back to
# the legacy event_waiter path -- see docs-internal/event_framework.md.
EVENT_FRAMEWORK_ENABLED=true
# Largest webhook request body accepted, in bytes (/webhook/... routes and
# Discord interactions); a larger one is refused with 413 before it reaches
# a workflow. A body rides into the workflow's input, which Temporal caps
# at 2 MB, and the trigger path copies it several times, so one oversized
# webhook could otherwise wedge a deployment.
WEBHOOK_MAX_BODY_BYTES=262144
# Memory compaction. ``true`` (default) auto-compacts an agent's
# conversation when it nears the model's context-window threshold (see
# COMPACTION_RATIO). Per-session overrides via the UI.
COMPACTION_ENABLED=true
# Compaction trigger threshold as a fraction of the model's context
# window (0.05 - 0.99). 0.8 = compact at 80%: AgentWorkflow measures the
# size of its next request, the in-process path the run's summed usage.
# Per-user overrides via the UserSettings row (Settings tab).
COMPACTION_RATIO=0.8
# Largest result (in characters) one external tool call may add to an
# agent's conversation. Longer results are cut, with a note telling the
# model to call the tool again with narrower parameters; only the model's
# copy is cut, never the tool's own result. Delegated-agent answers, skill
# loads and Task Manager results are never cut. 0 disables the cap.
# Per-user overrides via the UserSettings row (Settings tab).
TOOL_RESULT_MAX_CHARS=100000
# Agent loop hard step cap. AI Agent + Chat Agent stop the LLM/tool
# iteration loop after this many rounds and return a truncation note.
# Per-user overrides via the UserSettings row (Settings tab).
AGENT_RECURSION_LIMIT=200
# Multi-agent delegation. The concurrency limit counts all active children
# and grandchildren in one root execution; the root agent is not counted.
MAX_CONCURRENT_SUBAGENTS=3
MAX_DELEGATION_DEPTH=2
# Browser node. Uses installed Chrome/Edge/Chromium with a dedicated persistent
# profile displayed in the workspace UI by default, without a separate window.
# BROWSER_RUNTIME=testing explicitly opts into pinned Chrome for Testing.
# BROWSER_HEADLESS=false additionally opens a desktop browser window.
# BROWSER_MAX_INSTANCES caps running profiles — when
# another would exceed it, the least recently used idle profile is stopped
# first. BROWSER_IDLE_TIMEOUT_MS stops a profile's Chrome after that many
# milliseconds with no agent step, viewer or login (0 disables).
# BROWSER_INSTALL_TIMEOUT_SECONDS bounds CLI installation and testing downloads.
# BROWSER_SANDBOX: auto turns Chrome's sandbox off only as root on Linux
# (Docker, the GCP VM), where it cannot start; on/off force it.
# BROWSER_FAMILY selects chrome (default), edge, chromium, or auto by name.
# Discovery uses OS registration, PATH, and standard installation locations.
# BROWSER_CHROME_PATH is an optional explicit override; normally leave it empty.
# Auto-discovery skips browsers older than the selected profile requires.
# System mode never falls back to a testing-browser download.
# BROWSER_DOWNLOAD_MAX_MB caps each file a
# page downloads.
BROWSER_MAX_INSTANCES=3
BROWSER_IDLE_TIMEOUT_MS=600000
BROWSER_INSTALL_TIMEOUT_SECONDS=900
BROWSER_SANDBOX=auto
BROWSER_CHROME_PATH=
BROWSER_FAMILY=chrome
BROWSER_RUNTIME=system
BROWSER_HEADLESS=true
BROWSER_DOWNLOAD_MAX_MB=200
# Dead-letter queue for failed workflow executions. Off by default.
DLQ_ENABLED=false
# Data directory (base for all persistent storage: DBs, workspaces,
# workflows, claude state). User-home rooted by default — same
# convention claude code itself uses (`~/.claude/`), Stripe
# (`~/.config/stripe/`), ngrok (`~/.ngrok2/`). Survives `rm -rf` of
# the repo and lets multiple checkouts share state.
#
# Resolution rules (`server/core/paths.py::opencompany_root`):
# - `~/...` → user home (cross-platform via Path.expanduser)
# - absolute → used verbatim
# - relative → resolved under repo root (back-compat)
#
# Set to `.opencompany` (or `data`) if you want repo-local behaviour
# instead. Pre-cutover layouts (`<repo>/data/`, `<repo>/workflows/`)
# do NOT auto-migrate — see `server/core/paths.py` for the manual
# `mv` checklist if you're upgrading from an older release.
DATA_DIR=~/.opencompany
# Per-workflow workspace (nodes save files here, resolved under DATA_DIR)
WORKSPACE_BASE_DIR=workspaces
# Logging
LOG_LEVEL=INFO
LOG_FORMAT=text
# Rate Limiting (Relaxed for development)
RATE_LIMIT_ENABLED=false
RATE_LIMIT_REQUESTS=1000
RATE_LIMIT_WINDOW=60
# Service Timeouts (Extended for debugging)
AI_TIMEOUT=60
AI_MAX_RETRIES=1
AI_RETRY_DELAY=0.5
MAPS_TIMEOUT=30
# Health Check
HEALTH_CHECK_INTERVAL=60
# Cleanup Configuration (for long-running daemon)
CLEANUP_ENABLED=true
CLEANUP_INTERVAL=3600
CLEANUP_LOGS_MAX_COUNT=1000
CLEANUP_CACHE_MAX_AGE_HOURS=24
# Feature Toggles
WS_LOGGING_ENABLED=true
# Gunicorn Configuration (for production deployment)
# GUNICORN_TIMEOUT=120
# GUNICORN_GRACEFUL_TIMEOUT=30
# GUNICORN_KEEPALIVE=5
# GUNICORN_MAX_REQUESTS=10000
# GUNICORN_MAX_REQUESTS_JITTER=1000
# WebSocket Configuration (For remote Android device connections)
WEBSOCKET_URL=wss://relay.opencompany.sh/ws
WEBSOCKET_API_KEY=
# AI Proxy Configuration (Ollama-style proxy for Claude Code CLI)
# Default port for AI proxy servers (e.g., Ollama, Claude Code CLI proxy)
AI_PROXY_DEFAULT_PORT=11434
# OpenCompany Gateway (docs-internal/llm_gateway.md). On by default: the
# Connectors panel offers the "Gateway" card, and with a gateway key there, LLM
# calls for a provider this install has no key of its own for go through the
# gateway, billed to the key owner's monthly allowance. false hides the card
# and turns the routing off.
OPENCOMPANY_GATEWAY_ENABLED=true
OPENCOMPANY_GATEWAY_URL=https://api.gw.opencompany.sh
# Creation-only rollout switch. Saved/admitted agents retain their version.
NEW_AGENT_RUNTIME_V1_ENABLED=false
# Informational status only; never cancels or retries a provider request.
LLM_SLOW_WARNING_SECONDS=5