- Sequential (stages 1–3): One agent per stage: IdeaProcessor → IntentAnalyzer → PlatformSelector. Each is a single LLM call; there is no agent-to-agent call in this path.
- Parallel (execution): ProductManager, FrontendDev, BackendDev, DevOpsEngineer, ToolManager generate files in parallel from platform templates. Coordination is via shared
WorkflowContext,existingDeliverables, and agent system prompts. A2A (lib/a2a.ts) is available for richer interaction and tests.
lib/openai.ts and lib/platform-templates.ts; roles and communication flows are defined in lib/x402.ts (AGENT_ROLES).
Agent Lifecycle
Sequential agents (Idea, Intent, Platform)
- Invocation — API handler calls
processIdea,refineIntent, orselectPlatformwith user input andsessionId. - LLM call — One OpenRouter
createChatCompletionwith a JSONresponse_formatand agent-specific system + user prompts. - Response — Parsed JSON is returned; the handler persists to
WorkflowContext(DB or in-memory) and responds to the client. - No long-lived state — These agents are stateless per request.
Execution agents
- Invocation —
executeX402Workflowinlib/openaiis called from/api/executewithselectedPlatform,refinedRequirements,sessionId,agentsToExecute, andworkflowContext. - Template resolution —
generatePlatformDeliverablesinlib/platform-templatesgets the platform config (getWebAppTemplate, etc.), walksfolderStructure, and assigns each file to an agent viagetAgentForFile. - Parallel runs — Agents are grouped by name; each group runs in parallel (
Promise.all). Within an agent, files are generated in batches (e.g. 5) with small delays. - Per-file generation —
generateFileContentWithAgentbuilds a prompt from: agent system prompt,workflowContext,requirements,file,filePath,relatedFilesfromexistingDeliverables. It callscallOpenRouter(GROK). On failure,generateFileContentprovides fallback. - Post-processing —
deduplicateContentregenerates duplicate deliverables;reviewDeliverableschecks structure and completeness and setsreview_passed/review_issues. - Output —
deliverablesandexecution_resultare stored inWorkflowContextand returned from/api/execute.AgentStatandTransactionare updated.
Agent Types
| Type | Agents | Stage | Implementation |
|---|---|---|---|
| Idea | IdeaProcessor | idea_input | processIdea in openai.ts |
| Intent | IntentAnalyzer | intent_analysis | refineIntent in openai.ts |
| Platform | PlatformSelector | platform_selection | selectPlatform in openai.ts |
| Payment | PaymentValidator | payment_processing | validatePayment in solana.ts; not an LLM agent |
| Execution | ProductManager, FrontendDev, BackendDev, DevOpsEngineer, ToolManager | execution | generateFileContentWithAgent in platform-templates.ts |
AGENT_ROLES and A2A; they are not wired into the execution file-generation path. AIEngineer can be used if templates or getAgentForFile are extended.
Agent Communication
- Sequential: Only through
WorkflowContext(idea → analysis → answers → refined requirements → platform options). No direct A2A. - Execution: Via
workflowContext,existingDeliverables(related files), and fixed system prompts (e.g. “Coordinate with FrontendDev and BackendDev”).getAgentForFileensures a clear file–agent mapping. - A2A:
lib/a2a.tsprovidessendA2ARequest,sendA2AResponse,shareA2AData,sendA2ANotification, andA2AWorkflowIntegration. Used in/api/test/a2a; can be integrated into execution for request/response or data-sharing between agents.