AI Work Flow¶
Trigger¶
Member opens Playground to work with the assistant.
Flow¶
sequenceDiagram
participant U as User
participant FE as Frontend
participant CHAT as AI_Chat
participant SPD as Spending
participant DOC as Document_MCP
U->>FE: New message
FE->>CHAT: POST chat
CHAT->>SPD: Check or record spend
alt MCP tool needed
CHAT->>DOC: tools/call
DOC-->>CHAT: Document or screenshot
end
CHAT-->>FE: Assistant reply
FE-->>U: Rendered answer
Steps¶
- User selects or creates chat session.
- Frontend sends message with JWT to Chat service.
- Chat checks rate limits and token balance (Spending / Billing entitlements).
- Model generates reply; optional tool calls to Document MCP (files, screenshot).
- Spending records token usage; balance updated.
- Reply shown; session persisted for later.
Outcome¶
Answer delivered; ledger updated; session history retained.
Plan constraints¶
Tokens/month, rate limits, vision calls, image generation may be tier-specific.
Failure modes¶
| Failure | User impact |
|---|---|
| Quota exhausted | Chat rejected or degraded message |
| MCP tool error | Partial answer; user notified |
| Model provider outage | Retry or fallback provider if configured |