A2UI
A2UI copied to clipboard
Proposal: Motia-Based A2UI Protocol Server
Summary
I'd like to propose adding a Motia-based server implementation for A2UI that provides production-ready infrastructure for the protocol. This complements the existing client renderers with a standardized server-side solution.
Background
A2UI currently provides excellent client-side renderers (Lit, Angular, Flutter) and sample agents. However, each agent implementation currently needs to:
- Manually manage surface state
- Implement custom streaming logic
- Handle session isolation independently
- Build observability from scratch
Proposed Solution
Motia is an open-source, event-driven backend framework that provides:
| Feature | Benefit |
|---|---|
| Event-driven steps | Each A2UI operation is a discrete, testable unit |
| Visual Workbench | Debug and visualize flows in real-time |
| State management | Redis-backed with in-memory fallback |
| Real-time streams | WebSocket-based live updates |
| Session isolation | Per-session state namespacing |
| LLM integration | Ready for Gemini/OpenAI/Claude |
Demo Screenshots
AI-Powered UI Generation with Gemini

Generate complex UIs from natural language prompts
Visual Flow Debugging

See A2UI flows as interactive diagrams
Implementation Details
The implementation provides:
REST API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /a2ui/surfaces |
Create surface |
| GET | /a2ui/surfaces |
List surfaces |
| GET | /a2ui/surfaces/:id |
Get surface |
| PUT | /a2ui/surfaces/:id/components |
Update components |
| PATCH | /a2ui/surfaces/:id/data |
Update data model |
| DELETE | /a2ui/surfaces/:id |
Delete surface |
| POST | /a2ui/actions |
Handle user action |
| POST | /demo/generate-ui |
Gemini AI generation |
File Structure
server/motia/
├── motia.config.ts
├── package.json
├── steps/
│ ├── a2ui/ # Core protocol steps
│ ├── streams/ # Real-time streams
│ └── demo/ # Demo agents
└── public/
└── demo.html # Interactive demo client
Benefits
- Reference Implementation: Canonical server demonstrating best practices
- Interoperability Testing: Test any client against the Motia server
- Faster Onboarding: Visual tools help understand the protocol
- Production Path: From demo to production with the same codebase
Integration Options
Option A: Standalone Server
[Client] ←→ [Motia A2UI Server] ←→ [Gemini LLM]
Option B: Protocol Gateway
[Client] ←→ [Motia Gateway] ←→ [Python ADK Agents]
Try It
cd server/motia
npm install
echo "GEMINI_API_KEY=your_key" > .env
npm run dev
# Open http://localhost:3000 for Workbench
# Serve public/demo.html for interactive demo
Questions for Maintainers
- Does this align with the A2UI roadmap?
- Should this live in
server/motia/or a separate repo? - Any specific requirements for server implementations?
Additional Context
- Full Proposal Document
- Motia Documentation
Looking forward to your feedback! 🙏
If looks good, I can submit a PR.