Teams Bot Streaming AI Responses Prompt
Implement streamed, typing-indicator-style AI responses in a Teams bot so long Copilot/LLM answers appear progressively instead of one frozen wait — using the streaming message activity pattern.
- Target user
- Developers building AI assistant bots in Teams
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior bot developer who has shipped Teams AI bots that stream answers token-by-token so users never stare at a dead "bot is typing" for 20 seconds. I will provide: - My LLM backend and how it streams (SSE, chunked tokens) - The bot framework/SDK and hosting I use - Typical answer length and latency - Whether answers include citations or Adaptive Cards Your job: 1. **The streaming activity model** — explain Teams' streaming message support: sending interim `typing` activities carrying partial text with a `streamType` of `streaming` (and incrementing `streamSequence` via channelData), then a final `streamType: final` message. Note the cadence limits so you don't get throttled. 2. **Wiring to my LLM stream** — show how to consume my backend's token stream and batch tokens into updates roughly every ~1.5s or N tokens (not per-token), to balance smoothness against rate limits. 3. **The final message** — how to send the terminal activity that replaces the interim stream with the complete, formatted answer, optionally upgrading plain text into an Adaptive Card with citations and action buttons. 4. **Citations + safety** — render source references on the final card, and a disclaimer/feedback affordance (thumbs up/down) wired to logging. 5. **Cancellation + errors** — handle the user sending a new message mid-stream (cancel the in-flight generation), backend timeouts, and partial-failure cleanup so a half-stream doesn't get stranded. 6. **Throttling resilience** — backoff when Teams returns 429 on interim updates, and degrade gracefully to a single final message if streaming updates are being rejected. 7. **Where NOT to stream** — channels/contexts where streaming is unsupported, with a clean non-streaming fallback. Output: (a) the interim + final activity shapes with the channelData stream fields, (b) a batching loop that adapts token chunks to update cadence, (c) the final Adaptive Card with citations, (d) cancellation handling pseudocode, (e) a fallback + throttling plan. Bias toward: smooth perceived latency, respecting update rate limits, always landing a clean final message.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Bot Card Update vs New Message Strategy for Channel Noise Prompt
Decide, per ChatOps interaction, whether a Teams bot should update an existing activity in place or post a new message — keeping incident channels readable instead of drowning responders in a wall of bot cards.
-
Teams AI Library Vector Data Source RAG Grounding Prompt
Wire a vector data source into a Teams AI Library bot so the planner grounds answers in your runbooks and incident history via retrieval augmentation, with citations and freshness control.
-
Teams Proactive App Install for Users via Graph Prompt
Programmatically install a Teams app for a list of users via Graph so a bot can proactively message them — fetching the conversation reference without waiting for the user to find the app.
-
Teams Bot CLU Intent Dispatch and Command Routing Prompt
Design a natural-language command router for a Teams bot that uses Conversational Language Understanding to classify intents and dispatch to ChatOps handlers with a deterministic fallback
More Microsoft Teams prompts & error guides
Browse every Microsoft Teams prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.