Documentation Index
Fetch the complete documentation index at: https://docs.lucid.foundation/llms.txt
Use this file to discover all available pages before exploring further.
Agent Deployment Lifecycle
The Agent Deployment Lifecycle in Lucid is designed to manage deployments with a durable state machine, supporting reconciliation and blue-green rollouts. This guide provides an overview of the deployment process, state management, and associated features.Deployment State Management
Deployments in Lucid are tracked using a durable state machine, with states stored in Supabase tables:deployments and deployment_events. The state machine transitions through the following states:
pendingdeployingrunningstoppedterminatedfailed(alternative path)
provider_status column. Optimistic locking is implemented via the version column, and deployment revisions are tracked with the revision column. The deployment_slot supports blue-green deployments, with ‘primary’ as the default slot.
Deployment Events
Deployment events are logged in an append-only audit log, capturing key events such ascreated, succeeded, failed, terminated, and health_changed.
Deployment Store Interface
TheIDeploymentStore interface provides implementations for both Postgres (production) and InMemory (tests). The deployment event history can be accessed via the route:
Reconciliation and Drift Detection
The Reconciler is responsible for polling every 60 seconds to detect drift and repair stuck deployments. It includes a LeaseManager and WebhookHandler for provider status synchronization. Provider capabilities include support for stopping, resuming, extending, scaling, and logging.Drift Repair Rules
running+stopped-> redeployterminated+running-> terminatefailed+terminated-> terminated
Stuck Repair
The Reconciler checks the provider status to transition deployments torunning or failed, with retries implemented using a backoff strategy.
Environment variables for configuring the Reconciler include:
RECONCILER_POLL_MSRECONCILER_STUCK_TIMEOUT_MSRECONCILER_STALENESS_MSRECONCILER_LEASE_WARNING_MSRECONCILER_MAX_RETRIESLEASE_EXTENSION_HOURS
Blue-Green Rollout and Secrets Management
The RolloutManager handles blue-green rollouts, rollbacks, and promotions, separate from the Reconciler. Secrets are resolved at deploy time using theISecretsResolver interface, ensuring they are never stored.
Blue-Green Deployment Routes
POST .../deploy/blue-greenPOST .../promotePOST .../rollbackGET .../bluePOST .../blue/cancel
Secrets Resolver
Implementations includeEnvSecretsResolver for environment variables and MockSecretsResolver for testing. The getSecretsResolver() factory is used to obtain the appropriate resolver.
Environment configuration for secrets and rollout management:
SECRETS_PROVIDER=env|mockROLLOUT_HEALTH_GATE_MS=30000ROLLOUT_AUTO_PROMOTE=falseROLLOUT_AUTO_ROLLBACK=false
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=8b4c7e6431e9a6af1ef23b77bb4ff5fd)
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=d5651a45e4bfbabc33f74e146af3f94a)