Prompt file imported from synccinct/customagents-foundation (
.github/prompts/wiring/07-chat-execution-wiring.prompt.md). Copyright stays with the author.
Prompt 7 — Chat Execution Wiring
Wire the agent chat UI to a backend execution endpoint.
Goal
Customers can interact with their deployed agents through the dashboard.
Implement
- conversation model
- message model
- POST message endpoint
- GET conversations endpoint
- GET conversation messages endpoint
- UI conversation state
- message persistence
- execution adapter placeholder
- structured execution response
- error display
Execution Architecture
UI ChatWindow
-> API /agents/:agentId/chat
-> Auth/customer scope check
-> Agent lookup
-> ExecutionService
-> Provider/model adapter placeholder
-> Message persistence
-> Response returned to UI
Rules
- Do not expose provider API keys.
- Do not expose system prompts.
- Validate message length.
- Rate-limit hook or placeholder.
- Every request should have requestId.
- Log agentId, customerId, conversationId, latency, status.
- Store user and assistant messages.
Acceptance Criteria
- User can send a chat message from UI.
- API validates and stores message.
- Assistant placeholder response is stored and returned.
- UI renders message history.
- Errors are shown safely.
- Execution service can later plug into AIXpertise or provider layer.