init external ai python#2779
Conversation
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new AI Integrations documentation section to teams.md, focused on Python-only integration patterns (MCP Server + Agent Framework), and updates the language-availability manifest accordingly.
Changes:
- Introduces new
ai-integrations/template pages (README,mcp-server,agent-framework) withLanguageIncludesections. - Adds Python include fragments for MCP Server and Agent Framework guides.
- Updates
static/missing-pages.jsonto mark the new pages as unavailable for TypeScript and C#.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| teams.md/static/missing-pages.json | Marks new AI Integrations pages as missing for typescript and csharp. |
| teams.md/src/pages/templates/ai-integrations/category.json | Adds sidebar category for the new section. |
| teams.md/src/pages/templates/ai-integrations/README.mdx | Adds AI Integrations landing page (Python-only). |
| teams.md/src/pages/templates/ai-integrations/mcp-server.mdx | Adds MCP Server guide template with LanguageInclude sections. |
| teams.md/src/pages/templates/ai-integrations/agent-framework.mdx | Adds Agent Framework guide template with LanguageInclude sections. |
| teams.md/src/components/include/ai-integrations/mcp-server/python.incl.md | Adds Python content/snippets for MCP Server integration. |
| teams.md/src/components/include/ai-integrations/agent-framework/python.incl.md | Adds Python content/snippets for Agent Framework integration. |
| """Send an Approve/Reject card. Returns an approval_id — poll get_approval for the decision.""" | ||
| conversation_id = await _get_or_create_conversation(user_id) | ||
| approval_id = str(uuid.uuid4()) | ||
| card = AdaptiveCard( | ||
| body=[ |
There was a problem hiding this comment.
[HIGH] In the approval snippet, uuid.uuid4() is used but uuid isn’t imported in that code block. If readers copy just this section it won’t run; include import uuid (or explicitly note it was imported earlier).
| from agent_framework import FunctionMiddleware | ||
|
|
||
| class CitationMiddleware(FunctionMiddleware): | ||
| citations: dict[str, dict] = {} |
There was a problem hiding this comment.
[HIGH] CitationMiddleware.citations: dict[str, dict] = {} defines a mutable class variable, so multiple instances (or tests) can accidentally share citation state. Make citations an instance attribute (e.g., set in __init__) to avoid cross-request leakage.
| citations: dict[str, dict] = {} | |
| def __init__(self): | |
| super().__init__() | |
| self.citations: dict[str, dict] = {} |
| pending_cards.set(cards) | ||
|
|
||
| full_text = "" | ||
| async for chunk in agent.run(ctx.activity.text or "", stream=True): | ||
| if chunk.text: | ||
| ctx.stream.emit(chunk.text) | ||
| full_text += chunk.text |
There was a problem hiding this comment.
[NIT] pending_cards.set(cards) isn’t reset, so if the handler code ever reuses the same task/context it can leak the card list into later work. Consider capturing the token from set(...) and resetting it in a finally block after streaming completes.
| pending_cards.set(cards) | |
| full_text = "" | |
| async for chunk in agent.run(ctx.activity.text or "", stream=True): | |
| if chunk.text: | |
| ctx.stream.emit(chunk.text) | |
| full_text += chunk.text | |
| token = pending_cards.set(cards) | |
| full_text = "" | |
| try: | |
| async for chunk in agent.run(ctx.activity.text or "", stream=True): | |
| if chunk.text: | |
| ctx.stream.emit(chunk.text) | |
| full_text += chunk.text | |
| finally: | |
| pending_cards.reset(token) |
Co-authored-by: Copilot <copilot@github.com>
No description provided.