Add agent framework example (and remove sample for chatprompt and mcp client) #386
Add agent framework example (and remove sample for chatprompt and mcp client) #386MehakBindra wants to merge 9 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s example apps by replacing older AI/MCP samples with a new agent-framework-based Teams bot sample, and refreshes the workspace lockfile accordingly.
Changes:
- Add a new
examples/ai-agentframeworksample that usesagent-framework+ Azure AI Foundry, with streaming, tools, and citations. - Remove the legacy
examples/ai-testandexamples/mcp-clientsamples. - Update
uv.lockto reflect new/removed example dependencies (including significant dependency graph changes).
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Updates workspace resolution for new example dependencies and removes old example entries. |
| examples/mcp-client/src/main.py | Removes the MCP client sample implementation. |
| examples/mcp-client/pyproject.toml | Removes the MCP client sample project metadata/deps. |
| examples/mcp-client/README.md | Removes MCP client sample documentation. |
| examples/ai-test/src/main.py | Removes the legacy AI test sample entrypoint. |
| examples/ai-test/src/handlers/plugins.py | Removes legacy AI plugin example code. |
| examples/ai-test/src/handlers/memory_management.py | Removes legacy memory management helper code. |
| examples/ai-test/src/handlers/function_calling.py | Removes legacy function calling example code. |
| examples/ai-test/src/handlers/feedback_management.py | Removes legacy feedback storage/handling example code. |
| examples/ai-test/src/handlers/citations.py | Removes legacy citations demo code. |
| examples/ai-test/src/handlers/init.py | Removes legacy handler package exports. |
| examples/ai-test/pyproject.toml | Removes AI test sample project metadata/deps. |
| examples/ai-test/README.md | Removes AI test sample documentation. |
| examples/ai-agentframework/src/mcp_tools.py | Adds MCP tool configuration for the new agent-framework sample. |
| examples/ai-agentframework/src/main.py | Adds the new sample’s Teams bot entrypoint with streaming + feedback + citation attachment. |
| examples/ai-agentframework/src/local_tools.py | Adds local deterministic tools (datetime/math/random/exchange-rate). |
| examples/ai-agentframework/src/instructions.txt | Adds system instructions for citation behavior and response formatting. |
| examples/ai-agentframework/src/agent.py | Adds agent setup (Foundry client, tools, middleware, citation extraction). |
| examples/ai-agentframework/pyproject.toml | Adds project metadata and dependencies for the new sample. |
| examples/ai-agentframework/README.md | Adds setup/run docs for the new agent-framework sample. |
…teams.py into mehak/msft-ai-samples
| CLIENT_SECRET=<client-secret> | ||
| ``` | ||
|
|
||
| The bot's Service Principal (`CLIENT_ID`) is used for both Teams and Azure AI Foundry — no separate Foundry credentials needed. |
There was a problem hiding this comment.
Let's showcase the default case using a key since that's what most people use.
There was a problem hiding this comment.
I thought we agreed to go with the JWT token for Microsoft Libs, don't mind changing but want to verify
There was a problem hiding this comment.
I don't think this is a good idea. This implies several things:
- You have az installed and available
- If you deploy this, you are deploying on azure
My understanding is that we want to use keys... that was my interpretation, but maybe I'm wrong.
|
|
||
| The bot's Service Principal (`CLIENT_ID`) is used for both Teams and Azure AI Foundry — no separate Foundry credentials needed. | ||
|
|
||
| ### Azure AI Foundry permissions |
There was a problem hiding this comment.
This sample should be agnostic of the AI provider as much as we can showcase it. Someone should be able to come with OpenAI keys, and it should be very close to what it is. So let's now add this requirement if we can avoid it.
| ## Local Tools | ||
|
|
||
| | Tool | Description | | ||
| | ---------------------- | --------------------------------------------- | | ||
| | `get_current_datetime` | Current date and time for any UTC offset | | ||
| | `calculate` | Evaluate mathematical expressions accurately | | ||
| | `random_pick` | Randomly select one or more items from a list | | ||
| | `get_exchange_rate` | Live currency conversion via frankfurter.app | | ||
|
|
||
| ## MCP Tools | ||
|
|
||
| | Tool | Type | Credentials | | ||
| | --------------- | --------------- | ----------- | | ||
| | `MSLearn` | Streamable HTTP | None | | ||
| | `AdaptiveCards` | Stdio (npx) | None | |
There was a problem hiding this comment.
I'm unsure if this is worth showcasing anymore...
There was a problem hiding this comment.
(I mean this for Local tools + MCP Tools).
Unless they were showcasing some Teams feature...
There was a problem hiding this comment.
We are showcasing how to call tools using Agent framework, log and track their input, output, add inline citations based on links from chained tool calls, structured output from calls to be sent as attachments and streaming for unstructured. I think all of this is useful showcase of integration with Teams UX features. I think the MCP tools ( one shows citations well, and the other structured output to adaptive card attachments ) are good, maybe can do something about local functions later ..
There was a problem hiding this comment.
Also plan on adding graph mcp
|
|
||
| - Python >= 3.12, < 3.15 | ||
| - UV >= 0.8.11 | ||
| - Node.js (for MCP stdio servers) |
There was a problem hiding this comment.
This seems like a strange pre-req for this sample
There was a problem hiding this comment.
MCPStdioTool(name="AdaptiveCards", command="npx", args=["adaptive-cards-mcp"]) the AdaptiveCards MCP tool runs via npx
There was a problem hiding this comment.
I dont think local mcp tools is worth showcasing
| async for chunk in agent.run(text, session=_sessions[ctx.activity.conversation.id], stream=True): | ||
| if chunk.text: | ||
| ctx.stream.emit(chunk.text) | ||
| full_text += chunk.text |
There was a problem hiding this comment.
why are we building the full reply here?
There was a problem hiding this comment.
to process in line citations
| uv run src/main.py | ||
| ``` | ||
|
|
||
| ## Local Tools |
There was a problem hiding this comment.
could we put this section near the top, before prereqs?
Adds a new example (examples/ai-agentframework/) showing how to build a Teams bot using agent framework with tool calling.
The example covers: