ReactWrite is a multi-agent orchestration platform where AI agents dynamically collaborate to solve complex tasks. The system uses a human-in-the-loop approach, pausing for user review before executing the orchestrated workflow.
User Input
↓
Task Planner Agent
↓
Logic Checker Agent (validates plan)
↓ (loop until valid)
Orchestrator Agent
↓
Creates Specialized Generic Agents (frontend expert, backend expert, integration expert, etc.)
↓
[PAUSE] Human Review & Approval
↓
Execute Tasks with Coding Agents with tools
↓
Code feeback agent (this is the expert lead dev checking code and giving feedback or clearing it for production)
↓
Logic Checker Agent (validates each task is complete)
↓ (loop until valid per task)
Completion & User Feedback
- Uses Anthropic Claude Agent SDK for execution
- Built-in streaming message generation
- Type-safe with SDK's query() function
- Implements retry logic (max 3 attempts)
- Updates task status throughout execution
- Supports all Claude models via SDK
Phase 1: Planning (run)
- Get Task Planner agent
- Create planning task
- Execute planner
- Validate plan with Logic Checker (loop)
- Get Orchestrator agent
- Execute orchestrator to generate specialized agents
- Create specialized agents in database
- PAUSE execution (status: 'paused')
Phase 2: Execution (resume)
- Load specialized agents from database
- Create tasks for each agent
- Execute tasks with logic checking
- Mark execution complete
- Type:
planner - Purpose: Break down user requests into tasks
- Output: JSON with tasks array and strategy
- Type:
orchestrator - Purpose: Create specialized agents for each task
- Output: JSON with agents array and assignments
- Type:
logic_checker - Purpose: Validate work completion
- Output: JSON with passed boolean and feedback
- Type:
generic - Purpose: User-configurable for any task
- Configuration: Full control over prompts, model, params
createAgentAction- Create new agentupdateAgentAction- Update agent configdeleteAgentAction- Remove agentcreateWorkflowAction- Create workflowupdateWorkflowAction- Update workflowdeleteWorkflowAction- Remove workflowstartExecutionAction- Start workflow (Phase 1)resumeExecutionAction- Resume workflow (Phase 2)
/(dashboard)
/page.tsx - Dashboard with stats
/agents
/page.tsx - Agent list
/workflows
/page.tsx - Workflow list
/executions
/page.tsx - Execution history
/setup
/page.tsx - Initialize default agents
All pages are Server Components that:
- Check authentication
- Fetch user's organization
- Query relevant data
- Render UI
- User submits prompt via UI
startExecutionActioncalled- Creates execution record (status: 'pending')
startWorkflowExecutionruns orchestration Phase 1- Execution paused (status: 'paused')
- UI displays plan + generated agents for review
- User approves and clicks "Run"
resumeExecutionActioncalledresumeWorkflowExecutionruns orchestration Phase 2- Execution completes (status: 'completed')
for each task:
attempt = 0
while attempt < maxAttempts:
execute agent
send output to logic checker
if logic checker passes:
mark task complete
break
else:
increment attempt
retry with feedback- Full TypeScript types for all tables
- Insert types (without id, timestamps)
- Update types (partial, without id/team_id)
- Message interface
- AgentResponse interface
- Structured output types (TaskPlannerOutput, etc.)
- Supabase Auth with email/password
- Session stored in cookies via @supabase/ssr
- Row Level Security (RLS) on all tables
- team_id check:
WHERE team_id IN (SELECT team_id FROM profiles WHERE id = auth.uid()) - Enforced at database level, not application
- API keys stored in environment variables
- Never exposed to client
- Server-side only via Server Actions and API routes
- Synchronous task execution
- Single execution at a time per workflow
- In-memory message history
- Queue-based task execution (BullMQ, Inngest)
- Parallel task execution where possible
- Persistent message/log storage
- Streaming responses for real-time updates
- Webhook notifications on completion
- Database Errors - Thrown and caught by Server Actions
- LLM Errors - Retry logic (3 attempts)
- Validation Errors - Logic Checker provides feedback
- Auth Errors - Redirect to login
All errors surface to UI via Server Action return values:
{ success: false, error: string }- Database Indexes - On team_id, status, timestamps
- Server Components - No client-side JS for data fetching
- Streaming - Server Actions for mutations
- Caching - Next.js automatic caching with revalidatePath
- Make schema changes → Create migration
- Update types in
/lib/types - Add/update DB functions in
/lib/db - Implement business logic in
/lib/services - Create Server Actions in
/actions - Build UI in
/app(Server Components)
- Unit Tests - Service layer logic
- Integration Tests - Database queries
- E2E Tests - Full workflow execution
- LLM Tests - Prompt validation with test cases
This architecture prioritizes:
- Type Safety - Strict TypeScript
- Security - RLS + Server-side API calls
- Simplicity - Clear separation of concerns
- Performance - Server Components + caching
- Scalability - Service layer ready for queues/workers