Skip to content

Add Python LangChain sample agent#270

Open
Yogeshp-MSFT wants to merge 6 commits intomicrosoft:mainfrom
Yogeshp-MSFT:LangchainNew-sample
Open

Add Python LangChain sample agent#270
Yogeshp-MSFT wants to merge 6 commits intomicrosoft:mainfrom
Yogeshp-MSFT:LangchainNew-sample

Conversation

@Yogeshp-MSFT
Copy link
Copy Markdown

Adds a Python sample agent using LangChain/LangGraph with the Microsoft Agent 365 SDK, following existing Python sample patterns.

Files: python/langchain/sample-agent/ — main.py, hosting.py, agent.py, agent_interface.py, mcp_tool_registration_service.py, pyproject.toml, .env.template, ToolingManifest.json, README.md

Highlights:

  • LangGraph create_react_agent with MCP tools (Mail + Calendar) via langchain-mcp-adapters
  • Supports Azure OpenAI, Azure AI Foundry (/v1), and plain OpenAI
  • Agentic auth (OBO flow), JWT middleware, bearer token with expiry check
  • Teams patterns: immediate ack, typing indicators, multiple messages
  • Email, Word comment, and generic notification handlers
  • OpenTelemetry observability with BaggageBuilder
  • Comprehensive README with quick start, config reference, deployment, and troubleshooting

Tested: Locally with Agents Playground + deployed on Azure App Service + Teams.

@Yogeshp-MSFT Yogeshp-MSFT requested a review from a team as a code owner April 10, 2026 09:45
Copilot AI review requested due to automatic review settings April 10, 2026 09:45
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new Python sample agent demonstrating how to host a LangChain/LangGraph “ReAct” agent on the Microsoft Agent 365 SDK, including MCP tool discovery, auth flows, and observability patterns.

Changes:

  • Introduces a runnable aiohttp-hosted agent app with Teams-friendly UX (ack + typing loop) and notification handlers.
  • Adds MCP tool discovery/registration via langchain-mcp-adapters and A365 tooling services.
  • Adds project scaffolding (pyproject, env template, manifest, README) for local dev and Azure deployment.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
python/langchain/sample-agent/pyproject.toml Defines dependencies and uv/setuptools configuration for the sample.
python/langchain/sample-agent/mcp_tool_registration_service.py Implements MCP server discovery and tool registration for LangChain.
python/langchain/sample-agent/main.py Boots the aiohttp server, configures optional JWT auth, enables observability.
python/langchain/sample-agent/hosting.py Implements AgentApplication handlers (messages, typing loop, notifications).
python/langchain/sample-agent/agent_interface.py Defines the async interface the hosted agent must implement.
python/langchain/sample-agent/agent.py Creates the LLM client, loads MCP tools, invokes LangGraph ReAct agent, sets baggage.
python/langchain/sample-agent/ToolingManifest.json Provides MCP server definitions for Mail and Calendar tools.
python/langchain/sample-agent/README.md Documents setup, configuration, local testing, and deployment.
python/langchain/sample-agent/.gitignore Ignores local secrets, build outputs, and A365 generated artifacts.
python/langchain/sample-agent/.env.template Provides a starting environment configuration for local/prod scenarios.

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Yogeshp-MSFT and others added 4 commits April 10, 2026 16:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.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