Skip to content

Add agent framework example (and remove sample for chatprompt and mcp client) #386

Open
MehakBindra wants to merge 9 commits intomainfrom
mehak/msft-ai-samples
Open

Add agent framework example (and remove sample for chatprompt and mcp client) #386
MehakBindra wants to merge 9 commits intomainfrom
mehak/msft-ai-samples

Conversation

@MehakBindra
Copy link
Copy Markdown
Contributor

@MehakBindra MehakBindra commented Apr 13, 2026

Adds a new example (examples/ai-agentframework/) showing how to build a Teams bot using agent framework with tool calling.

The example covers:

  • Local tools (datetime, math, random, currency conversion)
  • MCP tools (MSLearn, AdaptiveCards)
  • Streaming responses with citation handling
  • Per-conversation session management

Copilot AI review requested due to automatic review settings April 13, 2026 21:49
@MehakBindra MehakBindra marked this pull request as draft April 13, 2026 21:49
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

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-agentframework sample that uses agent-framework + Azure AI Foundry, with streaming, tools, and citations.
  • Remove the legacy examples/ai-test and examples/mcp-client samples.
  • Update uv.lock to 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.

Comment thread examples/ai-agentframework/src/local_tools.py Outdated
Comment thread examples/ai-agentframework/src/main.py Outdated
Comment thread examples/ai-agentframework/src/main.py Outdated
Comment thread examples/ai-agentframework/src/agent.py Outdated
Comment thread examples/ai-agentframework/src/agent.py
Comment thread examples/ai-agentframework/src/local_tools.py
@MehakBindra MehakBindra changed the title agent framework sample Add AI Add agent framework example (and remove sample for chatprompt and mcp client) Apr 13, 2026
@MehakBindra MehakBindra changed the title Add AI Add agent framework example (and remove sample for chatprompt and mcp client) Add agent framework example (and remove sample for chatprompt and mcp client) Apr 13, 2026
@MehakBindra MehakBindra marked this pull request as ready for review April 14, 2026 00:23
Comment thread examples/ai-agentframework/README.md Outdated
Comment thread examples/ai-agentframework/src/agent.py Outdated
Comment thread examples/ai-agentframework/src/main.py
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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's showcase the default case using a key since that's what most people use.

Copy link
Copy Markdown
Contributor Author

@MehakBindra MehakBindra Apr 16, 2026

Choose a reason for hiding this comment

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

I thought we agreed to go with the JWT token for Microsoft Libs, don't mind changing but want to verify

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think this is a good idea. This implies several things:

  1. You have az installed and available
  2. 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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

^ same

Comment thread examples/ai-agentframework/README.md Outdated
Comment on lines +73 to +87
## 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 |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm unsure if this is worth showcasing anymore...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(I mean this for Local tools + MCP Tools).

Unless they were showcasing some Teams feature...

Copy link
Copy Markdown
Contributor Author

@MehakBindra MehakBindra Apr 16, 2026

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also plan on adding graph mcp


- Python >= 3.12, < 3.15
- UV >= 0.8.11
- Node.js (for MCP stdio servers)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems like a strange pre-req for this sample

Copy link
Copy Markdown
Contributor Author

@MehakBindra MehakBindra Apr 16, 2026

Choose a reason for hiding this comment

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

MCPStdioTool(name="AdaptiveCards", command="npx", args=["adaptive-cards-mcp"]) the AdaptiveCards MCP tool runs via npx

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I dont think local mcp tools is worth showcasing

Comment thread examples/ai-agentframework/README.md
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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why are we building the full reply here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

to process in line citations

Comment thread examples/ai-agentframework/src/main.py
Comment thread examples/ai-agentframework/src/agent.py Outdated
Comment thread examples/ai-agentframework/src/main.py
Comment thread examples/ai-agentframework/README.md
Comment thread examples/ai-agentframework/README.md Outdated
uv run src/main.py
```

## Local Tools
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could we put this section near the top, before prereqs?

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.

4 participants