How the AI Agent generates slides
mainThe AI agent is implemented as a Claude CLI subprocess spawned from the /api/chat endpoint with --allowedTools Bash WebFetch.
When a user requests a slide, the following workflow occurs:
- Context Loading: Claude reads your brand configuration and the active carousel state from the system prompt.
- HTML Generation: Claude writes the slide content as a complete HTML/CSS string (body-level only).
- Slide Submission: Claude uses its
Bashtool to execute acurlPOST request to/api/carousels/[id]/slidescontaining the HTML string. - UI Update: The new slide is saved to the local data store and appears in the editor's filmstrip via Server-Sent Events (SSE).