Synapse: The Data Brain of Your Business
Inside Synapse Studio — the central nervous system that organizes AI agents, tasks, events and context in a visual building-and-floor structure, with gamification, leaderboards and autonomous execution.
Imagine your company as a building. Each floor is a department: sales, support, marketing, operations. On each floor, AI agents with specific roles work, execute tasks, respond to events and communicate with each other. Synapse Studio isn't a metaphor — it's literally how Cadences models your business operations.
With over 4,900 lines of backend API, Synapse is the largest module in Cadences. There are 35+ endpoints covering everything from agent creation to autonomous AI task execution, including a complete gamification system with experience points, achievements and leaderboards.
The building metaphor
Synapse models your organization as a building with floors. Each floor has its own context, assigned agents and configuration. A "Sales" agent on Floor 2 can't see "HR" data on Floor 5 — isolation is architectural, not a permission someone forgets to set.
Buildings, Floors, Agents and Tasks
Everything in Synapse revolves around four fundamental entities. The hierarchy is clear: the organization has buildings, buildings have floors, floors have agents, and agents execute tasks.
Buildings
The top-level organizational unit. A company can have multiple buildings: "HQ", "LATAM Operations", "AI Center". Each with its own configuration and visual theme.
Floors
Departments within the building. Each floor has its own context — documents, base prompts, reference data — that feeds the agents working on it. They can be dynamically created, reordered and deleted.
Agents
AI workers with name, role, department, level, personality, avatar, state (idle/working/break), mood, energy, XP and visual position on the floor. Each agent has its own system_prompt and personality config.
Tasks
Assignable work units with title, description, priority (low/medium/high/critical), type (text/image/vision/audio/data/mixed), AI prompt, and approval flow (approve/reject). Executed against AI models configurable per organization.
35+ Endpoints, One Single Router
All of Synapse's backend lives in a single catch-all file ([[path]].js) that routes by URL segments. This simplifies deployment and allows every endpoint to share utilities like generateId(), generateContent() and direct D1 access.
| Resource | Operations | Usage |
|---|---|---|
| Buildings | GET, POST, PUT | Create and manage organizational buildings |
| Floors | GET, POST, PUT, DELETE + Context | Floors with their own document context |
| Agents | CRUD + State, Break, Achievements, Ratings | Full AI agent management with gamification |
| Tasks | CRUD + Execute, Steps, Approve, Reject, Report | Tasks with AI execution and approval flow |
| Events | GET, POST, Batch | System event logging (audit trail) |
| Conversations | GET, POST | Conversation history between agents and users |
| Input Sources | CRUD + Form Link + Items | Data sources: emails, forms, APIs, webhooks |
| Output Destinations | CRUD + Items + Send | Destinations: emails, Slack, webhooks, reports |
| Context Analysis | POST analyze, GET latest | Automatic analysis of agent and task state |
| Scores / Leaderboard | GET scores, GET leaderboard | Agent scores and XP-based ranking |
| Achievements | GET by org/agent | Unlockable achievements with tiers and XP rewards |
| Templates | GET all, GET by dept | Predefined templates for agents and tasks |
| Org Config | GET, PUT | AI configuration, models and tier per organization |
Anatomy of a Synapse Agent
Each agent in Synapse has over 20 attributes that define who it is, what it does, how it feels and where it is. This goes far beyond a simple "chatbot with a prompt" — it's a digital worker with state, personality and progression.
◆ Identity
name— Agent namerole— Type: agent, supervisor, analystrole_title— Visible title: "Sales Rep", "QA Lead"department— Assigned departmentlevel— Experience level (1-N)avatar_sprite— Visual sprite for the UI
◆ Intelligence
system_prompt— Agent base instructionspersonality_config— Personality JSONcapabilities— Enabled abilitiescan_create_subtasks— Can create sub-tasksdata_access_level— Data access level
◆ Real-Time State
current_state— idle, working, break, offlinecurrent_mood— neutral, happy, focused, tiredenergy_level— 0.0 to 100.0consecutive_tasks— Tasks in a row without pausecurrent_task_id— Currently active tasklast_break_at— Last break taken
◆ Progression
xp_points— Accumulated experience pointsposition_x,position_y— Position on the flooris_active— Active or disabled- Unlockable achievements
- Ratings from other agents/users
How a Task Gets Executed with AI
When a task is executed in Synapse, the system orchestrates a chain of steps from AI config resolution through XP and achievement updates. The executeTaskInternal() function is callable both via HTTP and by the scheduler (cron), enabling autonomous execution without human intervention.
Config resolution
loadOrgConfigForTask() reads the organization's config table to determine which AI model to use, the access tier, token limits and provider (OpenAI, Anthropic, DeepSeek, etc.).
Prompt composition
Combines the assigned agent's system_prompt, the task's ai_prompt, the floor's context, and any attached input data. The result is a complete prompt with instructions + context + data.
AI execution (multi-type)
Based on the task_type, the corresponding service is invoked: generateContent() for text, generateVisionContent() for vision, generateImageContent() for images, or generateI2IContent() for image-to-image. Each returns a structured result.
Step logging
Each execution creates records in synapse_task_steps with step type, input, output, duration and status. This enables auditing exactly what the agent did, with what prompt, and how long it took.
State update + XP
The task moves to completed (or review if approval is required). The agent receives XP points, its energy drops, and the system checks if any achievement has been unlocked. If energy is low, the agent automatically goes on break.
Input Sources and Output Destinations
Synapse doesn't live in isolation. Input Sources are the data entry points: emails, web forms, webhooks, external APIs. Output Destinations are where results go: automated emails, Slack channels, webhooks, PDF reports.
→ Input Sources
Incoming emails are parsed and converted into items processable by agents.
Public form links with /form-link for direct data capture.
Receive data from external systems as JSON for automatic processing.
← Output Destinations
Send results, reports and notifications via email.
Notifications to team channels or external systems.
Each output is logged as an item with send status for full traceability.
XP, Achievements and Leaderboards
What makes Synapse unique is its gamification system. AI agents earn experience points (XP) for completing tasks, unlock achievements based on performance, and compete on an organizational leaderboard. This isn't just a visual detail — it's a way to measure and compare the effectiveness of different agent configurations.
XP Points
Each completed task awards XP based on its complexity and priority. Agents level up automatically.
Achievements
Achievements by category (productivity, quality, speed) with tiers (bronze → silver → gold) and bonus XP rewards.
Leaderboard
Per-organization rankings sorted by XP. Quickly identify which agents are performing best and which need tuning.
The ratings system lets users (and other agents) rate response quality. The endpoint calculates averages and totals for each agent, feeding a continuous improvement cycle: if an agent gets low ratings, you know its system_prompt needs refinement.
Real-Time Context Analysis
The POST /context/analyze endpoint takes an instant snapshot of the organization: which agents are active, what state they're in, what tasks are pending, and generates a structured analysis. This is callable manually or by the scheduler for continuous monitoring.
// Context analysis result
{
"id": "ctx_a1b2c3d4",
"agents": [
{ "name": "Ana - Sales", "state": "working", "mood": "focused", "energy": 72.5 },
{ "name": "Carlos - Support", "state": "idle", "mood": "neutral", "energy": 95.0 },
{ "name": "Legal Bot", "state": "break", "mood": "tired", "energy": 15.0 }
],
"tasks": [
{ "title": "Q1 Competitor Analysis", "status": "in_progress", "priority": "high" },
{ "title": "Lead follow-up email", "status": "pending", "priority": "medium" }
],
"timestamp": "2025-01-22T10:30:00Z"
} Bot Sessions: Long-Term Memory
Bot Sessions allow a bot to maintain memory between interactions. Each session stores conversation history, metadata and bot type (chat, assistant, workflow). They auto-clean with keep=N to retain only the latest N active sessions.
This is especially useful for agents that serve the same customer across multiple occasions: "Hello Maria, last time we talked about your marketing budget. Would you like to continue?" — without the user having to repeat context.
Ready-to-Use Templates
Synapse includes a bank of predefined templates for agents and tasks by department. A new user can deploy a complete "Sales" or "Support" floor with pre-configured agents, tested prompts and working workflows — in minutes, not weeks.
Sales
Support
Marketing
Legal
Finance
HR
Operations
R&D
Per-Organization Configuration
Each organization configures which AI models their agents use, token limits, and execution type. This allows an organization to use DeepSeek for analysis tasks and GPT-4 for creative generation — all from the same interface.
| Parameter | Description | Example |
|---|---|---|
| ai_provider | Primary provider | openai, anthropic, deepseek |
| ai_model | Specific model | gpt-4o, claude-3, deepseek-chat |
| max_tokens | Token limit per execution | 4096 |
| tier | Access level | free, pro, enterprise |
| vision_model | Model for image analysis | gpt-4o (vision) |
| image_model | Model for image generation | dall-e-3, stable-diffusion |
Multi-Tenant Isolation in Every Query
Every query in Synapse includes organization_id as a mandatory filter. An agent from Org A can never see, modify or execute tasks from Org B. This isolation doesn't depend on application permissions — it's in every WHERE clause of every SQL query.
Combined with the per-tenant Durable Objects system (described in the Multi-Tenant SaaS article), Synapse operates with database-level isolation (separate D1), process-level isolation (separate DO) and logic-level isolation (org_id in every query). Triple barrier, zero chance of leakage.
The Brain That Connects Everything
Synapse is more than an AI agent dashboard. It's the central nervous system that connects data inputs, intelligent processing, and result outputs — all modeled as a visual organization with buildings, floors and digital workers.
With built-in gamification, multi-type execution (text, image, vision, audio), approval flows, and per-organization AI configuration, Synapse turns the complexity of operating with multiple AI agents into something any team can manage — literally by looking at a building where each floor has its workers doing their jobs.
Technical summary
- ✦ 4,900+ lines of API, 35+ endpoints, catch-all router on Cloudflare Pages Functions
- ✦ Hierarchical model: Buildings → Floors (with context) → Agents → Tasks
- ✦ Agents with 20+ attributes: identity, AI, real-time state, progression
- ✦ Multi-type execution: text, vision, image, image-to-image, audio, data, mixed
- ✦ Gamification: XP, levels, tiered achievements, leaderboard, ratings
- ✦ Input Sources + Output Destinations for external system connectivity
- ✦ Context Analysis for automatic organizational snapshots
- ✦ Multi-tenant with org_id in every query, total isolation between organizations
Cadences Engineering
Technical documentation from the engineering team
Conversational Voice AI
From robotic IVRs to natural conversations
All articles →Codex Blog
Explore all technical documentation