Documentation
Everything you need to build with CesaFlow.
# Quick Start
Get your first AI-generated project running in under 2 minutes.
Create an account
curl -X POST https://api.cesaflow.ai/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "secret", "organization_name": "My Org"}'
# Response:
# { "api_key": "sk_...", "org_id": "..." }Start a run
curl -X POST https://api.cesaflow.ai/api/v1/runs \
-H "x-api-key: sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"objective": "Build a FastAPI todo app with JWT auth", "project_id": "my-todo"}'
# Response:
# { "run_id": "abc-123", "status": "pending" }Watch it build
# Poll for status curl https://api.cesaflow.ai/api/v1/runs/abc-123 \ -H "x-api-key: sk_YOUR_KEY" # Or connect WebSocket for live events: # wss://api.cesaflow.ai/ws/runs?api_key=sk_YOUR_KEY # Download when done: curl https://api.cesaflow.ai/api/v1/runs/abc-123/download \ -H "x-api-key: sk_YOUR_KEY" -o workspace.zip
# REST API Reference
Base URL: https://api.cesaflow.ai
Auth header: x-api-key: sk_YOUR_KEY
/api/v1/auth/registerCreate an account and get an API key
/api/v1/auth/loginLogin and get an API key
/api/v1/runsStart a new run (returns run_id immediately)
/api/v1/runsList all runs for your org
/api/v1/runs/{run_id}Get run status, nodes, and files
/api/v1/runs/{run_id}/downloadDownload workspace as ZIP
/api/v1/benchmark/tasksList all benchmark tasks
/api/v1/benchmark/runStart a benchmark run
/api/v1/benchmark/{id}Poll benchmark results
/api/v1/billing/usageGet monthly usage and budget
/ws/runs?api_key=KEYWebSocket: stream live run events
/api/v1/runs/{run_id}/cancelCancel a running run
/api/v1/runs/{run_id}/respondSubmit human-in-the-loop answer
/api/v1/runs/{run_id}/tokensToken usage and cost breakdown by agent
/api/v1/estimateEstimate cost/time for a project (3 scenarios)
/api/v1/discussion/startStart AI discussion session
/api/v1/discussion/turnContinue discussion (AI asks questions)
/api/v1/projectsCreate a new project
/api/v1/projectsList all projects for your org
/api/v1/cron/jobsCreate a scheduled cron job
/api/v1/cron/jobsList all cron jobs
/api/v1/cron/jobs/{job_id}Delete a cron job
/api/v1/mcp/serversAdd an MCP server
/api/v1/mcp/serversList MCP servers
/api/v1/mcp/servers/{id}/toolsGet tools from MCP server
/api/v1/team/inviteInvite a team member by email
/api/v1/team/membersList team members with roles
/api/v1/inline/editCmd+K: Edit selected code (IDE)
/api/v1/inline/chatCmd+L: Chat about file (IDE)
/api/v1/inline/completeTab completion (IDE)
/api/v1/marketplace/templatesBrowse agent templates
/api/v1/marketplace/templates/{id}/installInstall a template
/api/v1/github/webhookGitHub App webhook receiver
/api/v1/policiesCreate execution policy
/api/v1/models/freeList models with free tiers
/api/v1/models/compareCompare models by cost/speed
/api/v1/reviewSubmit code for AI review (diff or PR URL)
/api/v1/review/{review_id}Get review results
/api/v1/runs/{run_id}/chainGet all runs in a chain
/api/v1/runs/learning/statsLearning engine stats for your org
/api/v1/runs/hierarchy/personasList agent hierarchy personas and roles
/api/v1/runs/performance/insightsPerformance metrics and optimization suggestions
/api/v1/runs/money/templatesList revenue-generating project templates
/api/v1/runs/money/startStart a Money Mode run from template
/api/v1/runs/clone/profileGet your digital clone profile (learned preferences)
/api/v1/runs/clone/contextGet prompt-injectable clone context
/api/v1/runs/goal/startStart goal-mode autonomous execution
/api/v1/runs/goal/{goal_id}Get goal execution status
/api/v1/runs/auto-configGet auto-optimized execution config
/api/v1/runs/clone/decideDigital Clone autonomous decision
/api/v1/runs/clone/styleInferred code style preferences
/api/v1/runs/benchmark/trendBenchmark regression trend
/api/v1/runs/modules/availableList composable modules
/api/v1/runs/modules/resolveResolve module dependencies
/api/v1/marketplace/rateRate a marketplace template (1-5)
/api/v1/marketplace/ratings/{id}Get template average rating
/api/v1/runs/{run_id}/graphGet execution graph (nodes, dependencies, progress)
/api/v1/runs/{run_id}/logsGet all shared-memory logs for a run
/api/v1/runs/{run_id}/workspaceFile listing and summary for a run
/api/v1/runs/{run_id}/files/{path}Get file content (preview, max 500KB)
/api/v1/runs/{run_id}/files/{path}Save/edit file content (browser IDE)
/api/v1/runs/{run_id}/ide-urlGet OpenVSCode Server URL for this run
/api/v1/runs/{run_id}/waitingCheck if run has pending human input
/api/v1/billing/plansList all plan details (free/pro/enterprise)
/api/v1/billing/statusCurrent subscription status
/api/v1/billing/checkoutCreate Stripe Checkout Session
/api/v1/billing/portalGet Stripe Customer Portal URL
/api/v1/team/members/{user_id}Remove team member
/api/v1/team/members/{user_id}/roleUpdate member role
/api/v1/team/invite/{token}Get invite metadata (public)
/api/v1/team/invite/acceptAccept invite and create account
/api/v1/projects/{id}Get specific project
/api/v1/projects/{id}Update project
/api/v1/projects/{id}Delete project
/api/v1/model-credentialsStore encrypted model API key (BYOM)
/api/v1/model-credentialsList stored credentials (keys hidden)
/api/v1/model-credentials/{id}Remove stored credential
/api/v1/model-credentials/{id}/set-defaultSet default credential
/api/v1/marketplace/categoriesList template categories
/api/v1/marketplace/installedList installed templates for org
/api/v1/marketplace/templates/{id}/installUninstall template
/api/v1/auth/meGet current user and org info
/api/v1/auth/forgot-passwordSend password reset email
/api/v1/auth/reset-passwordReset password with token
/api/v1/mcp/servers/{id}Remove MCP server
/api/v1/tasksCreate and queue a task
/api/v1/tasksList tasks (filter by project, status)
/api/v1/tasks/{id}Get task details
/api/v1/tasks/{id}Update task
/api/v1/tasks/{id}/cancelCancel a task
/api/v1/capture/eventsCapture event from IDE/CLI/Git hook
/api/v1/capture/eventsList captured events
/api/v1/capture/events/{id}/convertConvert event to task
/api/v1/admin/vaultList all API vault entries (admin)
/api/v1/admin/vaultAdd API key to vault (admin)
/api/v1/admin/vault/{id}/testTest vault entry connection (admin)
/api/v1/runs/models/catalogFull model catalog (57+ models, 25+ providers)
/api/v1/runs/models/catalog/{provider}Models for specific provider
/api/v1/runs/free-runsFree runs remaining for this org
/healthSystem health check
/pingSimple ping/pong
curl -X POST https://api.cesaflow.ai/api/v1/runs \
-H "x-api-key: sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"objective": "Add WebSocket support to the chat feature",
"project_id": "my-chat-app"
}'
# If project_id exists:
# - Reuses /workspace/project_my-chat-app/ (files preserved)
# - Loads previous plan and file history
# - Planner knows what was already built// Connect: wss://api.cesaflow.ai/ws/runs?api_key=sk_KEY
// Events streamed:
{ "event": "run_started", "run_id": "...", "node_count": 4 }
{ "event": "token_chunk", "agent": "backend", "chunk": "..." }
{ "event": "file_written", "agent": "backend", "path": "main.py", "bytes": 1240 }
{ "event": "run_completed", "run_id": "...", "files": ["main.py", ...] }
{ "event": "human_input_required", "question": "Which database?" }# CLI Reference
Install the CLI for terminal-first workflows.
cd cli/ pip install -e . # Or with pipx: pipx install -e .
aios run "Build a REST API for a blog" aios run "Add JWT auth" --project my-blog aios run "Build a FastAPI app" --tasks backend,qa # select agents aios run "..." --model gpt-4o # override model
aios benchmark # run all 10 tasks aios benchmark --list # list available tasks aios benchmark --tasks hello_world,calculator # run specific tasks
aios logs <run-id> # stream events for a run aios logs <run-id> --follow # keep streaming until done
AIOS_API_KEY=sk_... # your API key AIOS_API_URL=https://api.cesaflow.ai # API base URL (default) OPENAI_API_KEY=sk_... # for agents to call LLMs GITHUB_TOKEN=ghp_... # for git/PR tools (optional) PLAYWRIGHT_ENABLED=1 # enable browser tool (optional)
# Agent Tools
All tools available to agents during a run. Agents choose which tools to call based on the task.
write_fileWrite content to a file in the workspace.
params: path: string, content: string
read_fileRead the contents of a workspace file.
params: path: string
list_filesList all files in the workspace.
run_commandExecute a shell command (pip install, pytest, npm, etc.).
params: command: string
read_test_outputRead the output of the last run_command call.
web_searchSearch the web via DuckDuckGo for documentation or packages.
params: query: string
browser_navigateNavigate to a URL (Playwright or httpx fallback).
params: url: string
browser_get_contentRead text content of the current page.
browser_clickClick an element on the current page.
params: selector: string
browser_screenshotTake a screenshot of the current page (base64 PNG).
git_initInitialize a git repo and make the first commit.
params: message?: string
git_statusRun git status and show last 5 commits.
github_create_prOpen a pull request via GitHub API (requires GITHUB_TOKEN).
params: owner, repo, title, body, head, base
ask_humanPause execution and ask the user a question. Run waits until user responds.
params: question: string
figma_get_fileAccess Figma design files and extract component information.
params: file_key: string
firecrawl_scrapeScrape and extract web content with JavaScript rendering and Markdown conversion.
params: url: string
pdf_to_textExtract text content from a PDF file.
params: path: string
generate_deployGenerate deployment configs for Vercel, Railway, Fly.io, Docker, or Render.
params: platform: string, app_name?: string
ssh_executeExecute commands on remote servers via SSH.
params: host: string, command: string, username?: string
send_emailSend emails via SMTP for notifications and reports.
params: to: string, subject: string, body: string
stripe_create_productCreate a Stripe product with pricing for subscription or one-time billing.
params: name: string, price_cents?: int, recurring?: bool
stripe_create_checkoutCreate a Stripe Checkout Session URL for accepting payments.
params: price_id: string, success_url?: string
setup_databaseGenerate database config, Docker Compose, and initialization scripts for PostgreSQL, SQLite, or MongoDB.
params: db_type?: string, app_name?: string
generate_envGenerate .env, .env.example, and .gitignore with proper project configuration.
params: app_name?: string, db_type?: string, include_stripe?: bool
deploy_to_platformExecute actual deployment to Vercel, Railway, Fly.io, or Docker.
params: platform: string, token?: string
http_requestMake HTTP GET/POST/PUT/DELETE requests to external APIs. SSRF-protected.
params: url: string, method?: string, headers?: object, body?: string
db_queryExecute read-only SQL queries against PostgreSQL. SELECT only, max 100 rows.
params: query: string, connection_string?: string
download_fileDownload files from URLs into the workspace. Max 10MB, SSRF-protected.
params: url: string, filename?: string
# Advanced Tools
Beyond the standard file/shell/browser tools, CesaFlow agents have access to real-world integration tools.
SSH
Execute commands on remote servers. Useful for deployment, server management, and monitoring.
ssh_execute(host="server.com", command="docker ps")Send emails via SMTP. Useful for notifications, reports, and automated communication.
send_email(to="[email protected]", subject="Deploy Complete", body="...")Stripe
Create products, prices, and checkout sessions. Agents can add payments to generated apps.
stripe_create_product(name="Pro Plan", price_cents=2900)Database
Generate database configs for PostgreSQL, SQLite, or MongoDB with Docker Compose and init scripts.
setup_database(db_type="postgresql", app_name="myapp")Deploy
Generate platform-specific deployment configs (Vercel, Railway, Fly.io, Docker, Render).
generate_deploy(platform="vercel", app_name="my-saas")Environment
Generate .env, .env.example, and .gitignore with proper configuration.
generate_env(app_name="myapp", include_stripe=true)# Architecture
How CesaFlow runs your task from start to finish.
Agent Pipeline
POST /api/v1/runs
β
βΌ
GraphScheduler
β
Wave 1: βββββββββββ
β Planner β β generates API Contract
βββββββββββ
β
Wave 2: βββββββββββ ββββββββββββ
β Backend β β Frontend β β run in PARALLEL
βββββββββββ ββββββββββββ
β β
Wave 3: βββββββββ¬ββββββββ
ββββββ΄βββββ
β QA β β waits for both
βββββββββββSelf-Debugging Loop
Agent runs β validates (pytest/syntax check)
β
ββ PASS β next wave
β
ββ FAIL β inject debug_info into prompt
{
error_type: "validation_failure",
failed_command: "pytest tests/",
full_output: "...", // full pytest output
failed_tests: [...], // parsed test names
attempt: 2
}
β agent retries (max 3 attempts)Project Memory
project_id = "my-blog"
Workspace: /workspace/project_my-blog/ β shared, persistent
DB key: project:my-blog:state β PostgreSQL project_memory
State stored:
{ project_id, total_runs, files[], runs[{objective, files, ts}] }
Next run with same project_id:
β Planner sees: "Continuation of project, existing files: [...]"
β DO NOT rewrite β build on top# Benchmark
CesaFlow includes a built-in benchmark suite: 10 coding tasks evaluated automatically, no human grading. This is CesaFlow's internal evaluation suite β not the academic SWE-bench dataset. It measures end-to-end agent capability across file generation, code correctness, and test execution.
hello_worldtrivialcalculatoreasyfastapi_healtheasytodo_apimediumdata_processingmediumauth_jwtmediumwebsocket_chathardasync_scraperhardreact_componentmediumdocker_composemediumEach task: 10 points max Check types: file_exists β does the required file exist? file_contains β does it contain the expected code? any_file_contains β does any file contain the pattern? Score = (passed_checks / total_checks) * 10 Grade: S (90+) Β· A (80+) Β· B (70+) Β· C (60+) Β· D (50+) Β· F (<50)
# Execution Personas
Choose a persona to tailor agent behavior to your use case. Pass persona in your run request.
fullstackPlanner + Backend + Frontend + QA β complete web apps
"Build a blog with auth and admin panel"
api_onlyPlanner + Backend + QA β REST APIs and microservices
"Create a payment webhook handler"
data_pipelinePlanner + Backend + QA β ETL, pandas, SQL processing
"Build a CSV import pipeline with validation"
saas_starterFull stack + auth, billing, multi-tenancy hints
"Launch a SaaS dashboard with Stripe"
microserviceSingle-responsibility service with Docker + health checks
"Image resizing microservice with S3"
curl -X POST https://api.cesaflow.ai/api/v1/runs \
-H "x-api-key: sk_YOUR_KEY" \
-d '{"objective": "Build a payment API", "persona": "api_only"}'# AI Discussion & Planning
Refine vague ideas through multi-turn conversation before executing. The AI asks focused questions to clarify requirements.
# 1. Start a session
POST /api/v1/discussion/start
{ "message": "I want to build something for managing tasks" }
# 2. AI asks clarifying questions
Response: { "reply": "Should it have user auth? REST or GraphQL?", "ready": false }
# 3. Continue the conversation
POST /api/v1/discussion/turn
{ "session_id": "...", "message": "REST with JWT, PostgreSQL, and team support" }
# 4. After 3-5 turns, AI declares ready
Response: { "ready": true, "refined_objective": "Build a task management REST API with JWT auth, PostgreSQL, team workspaces, and role-based access control" }
# 5. Execute the refined objective
POST /api/v1/runs
{ "objective": "<refined_objective>" }# Cost Estimation
Get detailed cost, time, and quality estimates before running. Returns 3 execution scenarios.
POST /api/v1/estimate
{ "objective": "Build a blog with auth and comments" }
Response:
{
"tasks": [
{ "name": "Setup project", "complexity": "low", "tokens_est": 2000 },
{ "name": "User auth system", "complexity": "medium", "tokens_est": 8000 },
...
],
"plans": [
{ "name": "Premium Fast", "model": "gpt-4o", "cost_usd": 0.12, "quality": 9.2, "risk": "low" },
{ "name": "Balanced", "model": "gemini-1.5-flash", "cost_usd": 0.03, "quality": 7.8, "risk": "medium" },
{ "name": "Free", "model": "groq-llama", "cost_usd": 0.00, "quality": 6.5, "risk": "high" }
]
}# MCP Integration
Connect external tools via Model Context Protocol. Agents can access GitHub, Linear, Slack, Notion, PostgreSQL, and any MCP-compatible server.
# Add an MCP server
POST /api/v1/mcp/servers
{
"name": "GitHub",
"url": "https://mcp-github.example.com",
"api_key": "ghp_..."
}
# List available tools from the server
GET /api/v1/mcp/servers/{server_id}/tools
Response: [
{ "name": "create_issue", "description": "Create GitHub issue" },
{ "name": "search_code", "description": "Search code in repos" },
...
]
# Tools are automatically available to agents during runs# Scheduled Runs (Cron)
Automate recurring tasks with standard cron expressions. Jobs persist across restarts.
# Create a daily job at 9 AM
POST /api/v1/cron/jobs
{
"label": "Daily report",
"objective": "Generate a summary report of yesterday's sales data",
"cron_expr": "0 9 * * *",
"project_id": "daily-reports"
}
# List all jobs
GET /api/v1/cron/jobs
# Delete a job
DELETE /api/v1/cron/jobs/{job_id}
# Cron format: minute hour day month day_of_week
# Examples: "0 9 * * *" (daily 9am), "0 */6 * * *" (every 6h), "0 9 * * 1" (Mon 9am)# GitHub App Integration
Connect CesaFlow as a GitHub App for automated PR reviews, issue fixes, and CI debugging.
Capabilities
- β’ PR Auto-Review: Opens a PR β CesaFlow reviews code, posts comments
- β’ Issue Fix Command: Comment
/cesaflow fixon any issue β agents analyze and submit a fix PR - β’ CI Debugging: Workflow fails β CesaFlow reads logs, identifies root cause, suggests fix
- β’ Issue Analysis: New issue opened β CesaFlow analyzes and creates a run
# Template Marketplace
Pre-built agent templates with optimized system prompts for specific frameworks and use cases.
# Human-in-the-Loop
Agents can pause execution and ask you questions when they need clarification.
# During a run, an agent calls the ask_human tool:
# Agent: "Should I use PostgreSQL or SQLite for the database?"
# WebSocket event:
{ "event": "human_input_required", "run_id": "...", "question": "Which database?" }
# Check if a run is waiting for input:
GET /api/v1/runs/{run_id}/waiting
# Submit your answer:
POST /api/v1/runs/{run_id}/respond
{ "answer": "Use PostgreSQL with SQLAlchemy" }
# Agent receives answer and continues execution# Inline AI (IDE Endpoints)
Fast single-turn endpoints for the CesaFlow IDE (browser-based, OpenVSCode Server). Target: <300ms response time.
POST /api/v1/inline/edit
{ "code": "def hello():\n print('hi')", "instruction": "Add type hints and docstring" }
Response: { "edited_code": "def hello() -> None:\n \"\"\"Greet the user.\"\"\"\n print('hi')", "summary": "Added return type and docstring" }POST /api/v1/inline/chat
{ "file_context": "...", "message": "What does this function do?" }
Response: { "reply": "This function validates JWT tokens..." }POST /api/v1/inline/complete
{ "prefix": "def calculate_tax(amount: float, ", "suffix": "):\n return" }
Response: { "completion": "rate: float = 0.2" }# Code Review API
AI-powered code review for pull requests and diffs. Submit code changes and get structured feedback with risk assessment, security analysis, and rollback plans.
# Review a GitHub PR
POST /api/v1/review
{
"github_url": "https://github.com/owner/repo/pull/123",
"focus": "security", // general | security | performance | style
"language": "auto"
}
# Or review a raw diff
POST /api/v1/review
{
"diff_content": "--- a/main.py\n+++ b/main.py\n@@ -1,3 +1,5 @@...",
"focus": "general"
}
# Response: { "review_id": "abc123", "status": "processing" }
# Poll for results
GET /api/v1/review/abc123
# Returns: { "status": "completed", "result": "## Summary\n..." }Review Output Includes
- β’ Summary: What the change does in 1-3 sentences
- β’ Risk Assessment: LOW / MEDIUM / HIGH with explanation
- β’ Issues Found: Critical, warning, and suggestion-level issues with fixes
- β’ Security Check: SQL injection, XSS, hardcoded secrets, input validation
- β’ Suggestions: Code quality, performance, and pattern improvements
- β’ Rollback Plan: What to do if the change causes production issues
# Multi-Run Chaining
Chain runs together for multi-step autonomous execution. When a run completes, it can automatically trigger the next objective.
POST /api/v1/runs
{
"objective": "Build a REST API for a blog",
"project_id": "my-blog",
"continuation": {
"next_objective": "Add frontend with React for the blog API",
"trigger_condition": "on_success",
"max_depth": 3,
"inherit_workspace": true,
"then": {
"next_objective": "Write E2E tests for the full-stack blog",
"trigger_condition": "on_success"
}
}
}
# Flow:
# Run 1: Build API β completes β triggers Run 2
# Run 2: Build frontend β completes β triggers Run 3
# Run 3: Write tests β completes β chain done
# Track the chain:
GET /api/v1/runs/{run_id}/chain
# Returns all runs in order with statusTrigger Conditions
- β’ on_success: Continue only if the run completed successfully
- β’ on_failure: Continue only if the run failed (useful for fallback strategies)
- β’ always: Continue regardless of outcome
- β’ spec_pass: Continue only if spec validation score β₯ 70
# Learning Engine
CesaFlow learns from every run. Error patterns are tracked per organization, and lessons are automatically injected into agent prompts to avoid repeating the same mistakes.
How It Works
- 1. Agent encounters a validation failure (tests fail, syntax error, etc.)
- 2. Error pattern is recorded: error type, message, agent, context
- 3. If the agent fixes the issue on retry, the fix is recorded too
- 4. On future runs, relevant lessons are injected into the agent's prompt
- 5. Agent avoids known patterns and applies known fixes proactively
GET /api/v1/runs/learning/stats
Response:
{
"total_patterns": 23,
"fixed_patterns": 18,
"by_agent": {
"backend": 12,
"frontend": 8,
"qa": 3
},
"top_errors": [
{ "type": "validation_failure", "count": 7, "agent": "backend" },
{ "type": "validation_failure", "count": 5, "agent": "frontend" }
]
}# Agent Hierarchy
CesaFlow supports multi-level agent organizations. Choose a hierarchy persona to control how agents are structured.
Available Personas
- β’ standard: Planner β Backend + Frontend β QA (default)
- β’ enterprise: CEO β CTO β Backend + Frontend β QA (full hierarchy with strategic planning)
- β’ with_devops: Planner β Backend + Frontend β QA β DevOps (includes deployment setup)
7 Agent Roles
- β’ CEO (Level 0): Strategic planning, prioritization, resource allocation. Delegates to CTO and Growth.
- β’ CTO (Level 1): Architecture, tech stack selection, system design. Delegates to Dev agents.
- β’ Backend (Level 2): API development, database, server-side logic.
- β’ Frontend (Level 2): UI development, responsive design, accessibility.
- β’ QA (Level 2): Testing, code review, quality assurance.
- β’ DevOps (Level 2): CI/CD, Docker, infrastructure, deployment.
- β’ Growth (Level 1): SEO, analytics, marketing, user research.
# Performance Insights
CesaFlow tracks run metrics and provides optimization suggestions. The system identifies trends and recommends the best models for your workload.
GET /api/v1/runs/performance/insights
Response:
{
"total_runs": 47,
"pass_rate": 85.1,
"avg_duration_s": 124.5,
"avg_cost_usd": 0.0342,
"trend": "improving",
"best_model": "claude-3-5-sonnet",
"model_usage": { ... },
"persona_stats": { ... },
"suggestions": [
"Performance looks healthy. Keep going!",
"Model 'claude-3-5-sonnet' has the best success rate"
]
}# Money Mode
Revenue-generating project templates. Pick a business model and CesaFlow builds the entire application β auth, payments, dashboard, and deployment config included.
POST /api/v1/runs/money/start
{
"template_id": "saas_mvp",
"customization": "Use React + Tailwind, target fitness industry"
}
# Response: { "run_id": "...", "template": "SaaS MVP", "revenue_model": "Subscription" }# Deploy
CesaFlow generates deployment configurations automatically. Use the with_devops build mode or the generate_deploy tool to create platform-specific configs.
Supported Platforms
- β’ Vercel: Best for Next.js and React apps. Generates vercel.json + .vercelignore
- β’ Railway: Full-stack apps with databases. Generates railway.toml + Procfile
- β’ Fly.io: Global Docker deployments. Generates fly.toml + Dockerfile
- β’ Render: Simple web services. Generates render.yaml
- β’ Docker: Self-hosted. Generates Dockerfile + docker-compose.yml
# During a run, agents can call: generate_deploy(platform="vercel", app_name="my-saas") # This creates deployment files in the workspace: # β vercel.json # β .vercelignore # Or for Docker: generate_deploy(platform="docker", app_name="my-api") # β Dockerfile # β docker-compose.yml # β .dockerignore
# Digital Clone
CesaFlow builds a digital clone of your preferences over time. It learns your tech stack, coding patterns, and project preferences β then instructs agents to work the way you would.
What It Learns
- β’ Tech Stack: Which languages and frameworks you use most (Python, TypeScript, React, FastAPI, etc.)
- β’ Build Mode: Your preferred agent persona (fullstack, api_only, enterprise, etc.)
- β’ AI Model: Which model performs best for your workloads
- β’ Project Patterns: Common keywords, file types, and architecture choices
GET /api/v1/runs/clone/profile
Response:
{
"status": "active",
"runs_analyzed": 23,
"preferred_stack": ["python", "typescript", "react"],
"preferred_persona": "fullstack",
"preferred_model": "claude-3-5-sonnet",
"top_keywords": [
{ "word": "api", "count": 8 },
{ "word": "auth", "count": 5 }
],
"profile_summary": "Primarily works with python, typescript, react. Prefers fullstack builds."
}
# Clone context is automatically injected into agent prompts:
GET /api/v1/runs/clone/context
# β "This user prefers: python, typescript. Default: fullstack. Adapt output accordingly."# Goal Mode
Set a high-level goal and CesaFlow autonomously decomposes it into tasks, chains them together, and executes until done. No "continue" needed.
POST /api/v1/runs/goal/start
{
"goal": "Build a complete SaaS product for project management with auth, teams, tasks, billing, and deploy to Vercel",
"project_id": "my-saas"
}
# CesaFlow:
# 1. Decomposes into 5 tasks:
# β Build auth system with JWT
# β Create team + task management API
# β Build React frontend with dashboard
# β Add Stripe billing integration
# β Generate Vercel deploy config + tests
#
# 2. Chains them automatically
# 3. Each task validates before continuing
# 4. Self-corrects on failure
#
# Response: { "goal_id": "...", "run_id": "...", "tasks": [...], "total_steps": 5 }GET /api/v1/runs/auto-config
# Returns optimal config based on your run history:
{
"auto_optimized": true,
"recommended_model": "claude-3-5-sonnet",
"recommended_strategy": "balanced",
"recommended_provider": "anthropic"
}
# CesaFlow analyzes your pass rate, cost trends, and model performance
# to automatically suggest the best configuration.Full Autonomy Stack
These systems work together for end-to-end autonomous execution:
- 1. Goal Mode decomposes objective into sequential tasks
- 2. Multi-Run Chaining auto-starts next task on completion
- 3. Agent Hierarchy assigns roles (CEOβCTOβDevβQA)
- 4. Self-Debug Loop retries on failure (3 attempts)
- 5. Learning Engine avoids past mistakes
- 6. Digital Clone applies your preferences automatically
- 7. Auto-Optimization selects best model from history
- 8. Guardrails enforce cost/runtime/tool limits safely
# Webhook Continuation
Enable indefinite autonomous execution by connecting external systems via webhooks. When a run completes, CesaFlow notifies your webhook β and if it responds with a new objective, a follow-up run starts automatically.
# Start a run with webhook
POST /api/v1/runs
{
"objective": "Build a REST API for blog",
"webhook_url": "https://your-server.com/cesaflow-hook"
}
# When run completes, CesaFlow POSTs to your webhook:
{
"event": "run_completed",
"run_id": "abc-123",
"status": "completed",
"files_count": 12,
"chain_id": "chain_abc"
}
# Your webhook can respond:
{ "continue": true, "next_objective": "Add frontend for the blog API" }
# β CesaFlow automatically starts a new run!
# Or stop the chain:
{ "continue": false }
# Use cases:
# β’ CI/CD pipelines (build β test β deploy stages)
# β’ Monitoring (daily check β fix if broken)
# β’ Multi-system orchestration# Composable Modules
Add pre-built capabilities to any project. Modules inject specific instructions into the agent prompt so it generates the right code for auth, payments, email, and more.
auth_jwtJWT authentication, registration, login, password resetpayments_stripeStripe checkout, subscriptions, webhooks, billing portalemail_smtpSMTP email sending with Jinja2 templatesfile_uploadS3-compatible file upload with image processingwebsocket_realtimeWebSocket real-time events, chat, notificationsadmin_panelAdmin dashboard, user management, CRUDsearch_full_textPostgreSQL full-text search with rankingrate_limitingAPI rate limiting with per-user quotasPOST /api/v1/runs/modules/resolve
{ "modules": ["admin_panel", "rate_limiting"] }
# Response:
{
"resolved": ["admin_panel", "rate_limiting", "auth_jwt"],
"added": [{ "module": "auth_jwt", "required_by": "admin_panel" }],
"conflicts": [],
"total": 3
}
# auth_jwt auto-added because admin_panel depends on it# Policies & Guardrails
Create execution policies to control model selection, cost limits, runtime constraints, tool access, and approval workflows.
POST /api/v1/policies
{
"name": "secure-production",
"model_strategy": "balanced",
"max_cost_usd": 5.0,
"max_runtime_minutes": 30,
"preferred_providers": ["anthropic", "openai", "groq"],
"fallback_enabled": true,
"blocked_commands": ["rm -rf", "sudo", "shutdown", "curl | bash"],
"allowed_tools": ["write_file", "read_file", "run_command", "list_files"],
"require_approval": true
}POST /api/v1/runs
{
"objective": "Build a payment API",
"policy_id": "abc123"
}
# Enforcement:
# β’ Cost tracked per node β run stops if limit exceeded
# β’ Runtime checked per wave β remaining nodes skipped if timeout
# β’ Blocked commands rejected at execution time
# β’ Only allowed tools available to agents
# β’ PR creation pauses for human approvalGuardrail Features
- β’ Cost Limit: Run stops if accumulated token cost exceeds max_cost_usd. A cost_limit_exceeded event is emitted.
- β’ Runtime Limit: Remaining nodes are skipped if execution exceeds max_runtime_minutes.
- β’ Blocked Commands: Shell commands matching blocked patterns are rejected before execution. Default blocks include rm -rf /, sudo, shutdown.
- β’ Tool Allowlist: When specified, agents can only use the listed tools. Empty = all tools available.
- β’ Approval Gate: When require_approval is true, the agent pauses and asks for human confirmation before creating pull requests.
- β’ Failover Chain: If the primary provider fails, CesaFlow automatically tries the next provider in preferred_providers list.
# API Vault & Key Management
CesaFlow separates admin and user API keys. Admin keys power chat/planning. User BYOM keys power full code generation.
How Keys Work
- β’ Admin Keys (API Vault): Used for chat, planner, discussion, code review, cost estimation. Admin adds keys via Nexus β API Vault. Supports 25+ providers with auto-fallback.
- β’ User Keys (BYOM): Used for full code generation (backend, frontend, QA agents). Users add their own keys via Dashboard β Model Settings. Admin keys are never used for user builds.
- β’ Fallback Chain: Active AI keys in the vault are tried in priority order. If provider 1 fails (quota, rate limit), provider 2 is tried automatically.
- β’ Separation: Admin and user keys are stored in different tables and never mixed. Admin costs are predictable (only lightweight operations).
# For each AI call, CesaFlow checks in this order: 1. User BYOM key (model_credentials table) β If found: use for ALL agents (planner + backend + frontend + qa) β User pays their provider directly 2. Admin Vault key (api_vault table) β only for allowed purposes β chat, planner, discussion, inline edit, review, estimate β NOT used for: backend, frontend, qa, devops agents β If no BYOM: backend/frontend/qa return "Add your own key" error 3. System config / env var (legacy fallback) β Same restrictions as vault # Fallback within vault: # Priority 10 (Groq) fails β try Priority 20 (Gemini) β Priority 30 (OpenAI)
# Model Catalog
57+ AI models across 25+ providers. Each model includes rate limits, pricing, and context window information.
GET /api/v1/runs/models/catalog
Response:
{
"total_models": 38,
"providers": [
{
"id": "groq",
"name": "Groq",
"model_count": 4,
"models": [
{
"id": "llama-3.3-70b-versatile",
"name": "Llama 3.3 70B",
"context": 128000,
"rate_limit": "30 req/min, 14400 tokens/min",
"pricing": "Free",
"best_for": "General, coding"
},
...
]
},
...
]
}
# Per-provider:
GET /api/v1/runs/models/catalog/openai
GET /api/v1/runs/models/catalog/anthropicFree Runs
Every new user gets 3 free runs using admin-provided AI keys. After that, users must add their own BYOM key.
GET /api/v1/runs/free-runs
β { "free_runs_remaining": 2, "free_runs_total": 3, "has_byom_key": false, "status": "free_runs_available" }# Resilience & Recovery
CesaFlow is built for reliability with wave-level checkpointing, graceful shutdown, and automatic recovery.
Wave Checkpointing
After each wave completes, the execution state is persisted to PostgreSQL. If the server crashes mid-run, completed waves are not re-executed on restart.
Graceful Shutdown
On SIGTERM, the orchestrator saves current state within a 25-second drain timeout. The run is marked as "interrupted" and can be resumed.
Auto-Resume
On startup, the system scans for interrupted or orphaned runs and automatically resumes them, skipping already-completed nodes.
Multi-Provider Failover
If the primary AI provider fails, CesaFlow automatically tries the next provider in the fallback chain. A run only fails after all providers are exhausted.
# FAQ
Which AI models does CesaFlow use?
By default, CesaFlow uses Qwen Plus (DashScope) β no API key needed for new users. You can override this with any model via Dashboard β Model Settings: Gemini, Claude, Groq, Mistral, DeepSeek, Ollama, and more are all supported.
Is GITHUB_TOKEN required?
No. Git tools (git_init, git_status) work without it. You only need GITHUB_TOKEN for github_create_pr β opening pull requests via the GitHub API.
Is the browser tool always active?
Browser navigation with Playwright requires PLAYWRIGHT_ENABLED=1 in your environment. Without it, browser_navigate falls back to plain HTTP via httpx β no JavaScript rendering.
How does project_id work?
When you pass project_id to a run, CesaFlow reuses the same workspace directory (/workspace/project_{id}/) so files persist across runs. The Planner also loads previous run history and tells agents not to overwrite existing code.
Can I bring my own model (BYOM)?
Yes. Go to Dashboard β Model Settings and enter your API key for any supported provider. CesaFlow will use your credentials for all runs.
How do I run CesaFlow locally?
Clone the repo and run: docker compose up -d. No API key needed β CesaFlow ships with a built-in Qwen system key. For your own models, add keys via Model Settings. Backend: port 8001, Frontend: port 3000.