Skip to content

init external ai python#2779

Draft
MehakBindra wants to merge 2 commits intomainfrom
mehak/ai-python-new
Draft

init external ai python#2779
MehakBindra wants to merge 2 commits intomainfrom
mehak/ai-python-new

Conversation

@MehakBindra
Copy link
Copy Markdown
Contributor

No description provided.

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 23:41
@MehakBindra MehakBindra marked this pull request as draft April 23, 2026 23:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) with LanguageInclude sections.
  • Adds Python include fragments for MCP Server and Agent Framework guides.
  • Updates static/missing-pages.json to 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.

Comment on lines +136 to +140
"""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=[
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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).

Copilot uses AI. Check for mistakes.
from agent_framework import FunctionMiddleware

class CitationMiddleware(FunctionMiddleware):
citations: dict[str, dict] = {}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
citations: dict[str, dict] = {}
def __init__(self):
super().__init__()
self.citations: dict[str, dict] = {}

Copilot uses AI. Check for mistakes.
Comment on lines +173 to +179
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
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <copilot@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants