-
Notifications
You must be signed in to change notification settings - Fork 7
Agent Framework SDK #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mrunalhirve128
merged 23 commits into
main
from
users/mrunalhirve/AgentFrameworkSDKInPython
Oct 31, 2025
Merged
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
cb94bc3
Agent framework
mrunalhirve128 f12a244
ruff format
mrunalhirve128 19917d7
update tooling service
mrunalhirve128 0082a80
fixed logger in open ai
mrunalhirve128 1289d10
Fix init for sk
mrunalhirve128 c82e08b
fix
mrunalhirve128 c734e46
Apply suggestion from @Copilot
mrunalhirve128 609d4d7
push main toml
mrunalhirve128 34a668b
Merge branch 'users/mrunalhirve/AgentFrameworkSDKInPython' of https:/…
mrunalhirve128 10b220d
resolve comments
mrunalhirve128 b8badbd
fix
mrunalhirve128 bb11f43
fix
mrunalhirve128 313c904
Update libraries/microsoft-agents-a365-tooling-extensions-openai/micr…
mrunalhirve128 320d67a
test
mrunalhirve128 9f16dee
Merge branch 'users/mrunalhirve/AgentFrameworkSDKInPython' of https:/…
mrunalhirve128 5cb7e41
Pr comment
mrunalhirve128 0f97ac2
Update libraries/microsoft-agents-a365-tooling-extensions-agentframew…
mrunalhirve128 bdc99f0
Update libraries/microsoft-agents-a365-tooling-extensions-agentframew…
mrunalhirve128 4338e58
Update libraries/microsoft-agents-a365-tooling-extensions-agentframew…
mrunalhirve128 c7baa68
Test
mrunalhirve128 e4d7fed
Merge branch 'users/mrunalhirve/AgentFrameworkSDKInPython' of https:/…
mrunalhirve128 6feac83
Ruff format
mrunalhirve128 06d695f
change
mrunalhirve128 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
285 changes: 285 additions & 0 deletions
285
libraries/microsoft-agents-a365-tooling-extensions-agentframework/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,285 @@ | ||
| # Microsoft Agent 365 Tooling Extensions - Agent Framework | ||
| [](https://badge.fury.io/py/microsoft-agents-a365-tooling-extensions-agentframework) | ||
|
|
||
| Agent Framework integration tools and MCP tool registration services for AI agent applications built with the Microsoft Agent 365 SDK. Provides specialized tooling for integrating MCP (Model Context Protocol) servers with Agent Framework agents and projects. | ||
|
|
||
| ## What is this? | ||
|
|
||
| This library is part of the Microsoft Agent 365 SDK for Python - a comprehensive framework for building enterprise-grade conversational AI agents. The Agent Framework tooling extensions specifically provide integration with Microsoft Agent Framework, enabling seamless registration and management of MCP tool servers within the Agent Framework ecosystem. | ||
|
|
||
| ## Key Features | ||
|
|
||
| ✅ **Agent Framework Integration** - Native integration with Microsoft Agent Framework | ||
| ✅ **MCP Tool Registration** - Automatic registration of MCP servers with Agent Framework agents | ||
| ✅ **Azure Identity Support** - Built-in Azure authentication with DefaultAzureCredential | ||
| ✅ **Tool Resource Management** - Comprehensive management of tool definitions and resources | ||
| ✅ **Multi-Environment Support** - Support for development and production deployment scenarios | ||
| ✅ **Enterprise Ready** - Production-grade tooling for Agent Framework-based agent deployments | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install microsoft-agents-a365-tooling-extensions-agentframework | ||
| ``` | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| The Agent Framework tooling extensions require the Agent Framework Core package: | ||
|
|
||
| ```bash | ||
| # Core Agent Framework (includes Azure OpenAI and OpenAI support by default) | ||
| # also includes workflows and orchestrations | ||
| pip install agent-framework-core --pre | ||
| ``` | ||
|
|
||
| **Optional Agent Framework packages:** | ||
| ```bash | ||
| # Core + Azure AI integration | ||
| pip install agent-framework-azure-ai --pre | ||
|
|
||
| # Core + Microsoft Copilot Studio integration | ||
| pip install agent-framework-copilotstudio --pre | ||
|
|
||
| # Core + both Microsoft Copilot Studio and Azure AI integration | ||
| pip install agent-framework-microsoft agent-framework-azure-ai --pre | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Basic Concepts | ||
|
|
||
| The Microsoft Agent 365 Agent Framework Tooling Extensions enable seamless integration between MCP tool servers and Agent Framework agents. Key concepts include: | ||
|
|
||
| - **MCP Tool Registration**: Automatic registration of tool definitions with Agent Framework | ||
| - **Agent Resource Management**: Management of agent resources and configurations | ||
| - **Tool Discovery**: Dynamic discovery and registration of available tools | ||
| - **Service Integration**: Integration with various service providers and backends | ||
|
|
||
| ### Basic Usage | ||
|
|
||
| ```python | ||
| import asyncio | ||
| from agent_framework import ChatAgent | ||
| from agent_framework.azure import AzureOpenAIChatClient | ||
| from microsoft_agents_a365.tooling.extensions.agentframework import ( | ||
| McpToolRegistrationService, | ||
| ) | ||
|
|
||
| async def main(): | ||
| # Initialize the MCP tool registration service | ||
| service = McpToolRegistrationService() | ||
|
|
||
| # Create Azure OpenAI chat client | ||
| chat_client = AzureOpenAIChatClient( | ||
| api_key='', | ||
| endpoint='', | ||
| deployment_name='', | ||
| api_version='', | ||
| ) | ||
|
|
||
| # Create agent with MCP tools from all configured servers | ||
| agent = await service.add_tool_servers_to_agent( | ||
| chat_client=chat_client, | ||
| agent_instructions="You are a helpful assistant that can provide weather and restaurant information.", | ||
| initial_tools=[], # Your existing tools | ||
| agent_user_id="user-123", | ||
| environment_id="prod", | ||
| auth_token="your-auth-token" | ||
| ) | ||
|
|
||
| if __name__ == "__main__": | ||
| asyncio.run(main()) | ||
| ``` | ||
|
|
||
| ### Advanced Configuration | ||
|
|
||
| ```python | ||
| import asyncio | ||
| from agent_framework import ChatAgent | ||
| from agent_framework.azure import AzureOpenAIChatClient | ||
| from microsoft_agents_a365.tooling.extensions.agentframework import ( | ||
| McpToolRegistrationService, | ||
| ) | ||
|
|
||
| async def main(): | ||
| # Initialize with custom logger | ||
| import logging | ||
|
|
||
| logger = logging.getLogger("my-agent") | ||
|
|
||
| service = McpToolRegistrationService( | ||
| logger=logger | ||
| ) | ||
|
|
||
| # Create Azure OpenAI chat client | ||
| chat_client = AzureOpenAIChatClient( | ||
| api_key='', | ||
| endpoint='', | ||
| deployment_name='', | ||
| api_version='', | ||
| ) | ||
|
|
||
| # Define existing tools (if any) | ||
| existing_tools = [ | ||
| # Your existing tools go here | ||
| ] | ||
|
|
||
| # Create agent with comprehensive instructions and all MCP tools | ||
| agent = await service.add_tool_servers_to_agent( | ||
| chat_client=chat_client, | ||
| agent_instructions=""" | ||
| You are a helpful AI assistant with access to various tools and services. | ||
|
|
||
| Guidelines: | ||
| 1) Always be helpful and accurate | ||
| 2) Use available tools when appropriate to provide better assistance | ||
| 3) Explain your reasoning when using tools | ||
|
|
||
| You have access to MCP (Model Context Protocol) tools that are automatically | ||
| loaded from configured servers. Use these tools to enhance your capabilities. | ||
| """, | ||
| initial_tools=existing_tools, | ||
| agent_user_id="user-123", | ||
| environment_id="production", | ||
| auth_token="your-auth-token" | ||
| ) | ||
|
|
||
| # The agent now has all MCP tools from configured servers | ||
| print(f"Agent created with {len(agent.tools)} total tools") | ||
|
|
||
| if __name__ == "__main__": | ||
| asyncio.run(main()) | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| The library supports various configuration options through environment variables: | ||
|
|
||
| - `AGENT_FRAMEWORK_ENDPOINT`: The Agent Framework endpoint URL | ||
| - `AGENT_FRAMEWORK_API_KEY`: API key for Agent Framework authentication | ||
| - `MCP_TOOLS_DIRECTORY`: Directory containing MCP tool definitions | ||
| - `AGENT_ENVIRONMENT`: Deployment environment (development, staging, production) | ||
|
|
||
| ## Agent Framework Integration | ||
|
|
||
| This library provides deep integration with Microsoft Agent Framework using the `ChatAgent` pattern: | ||
|
|
||
| ### MCP Tool Server Registration | ||
|
|
||
| Automatically register MCP tools from all configured servers with your Agent Framework agents: | ||
|
|
||
| ```python | ||
| from agent_framework import ChatAgent | ||
| from agent_framework.azure import AzureOpenAIChatClient | ||
| from microsoft_agents_a365.tooling.extensions.agentframework import ( | ||
| McpToolRegistrationService, | ||
| ) | ||
|
|
||
| service = McpToolRegistrationService() | ||
|
|
||
| # Create Azure OpenAI chat client | ||
| chat_client = AzureOpenAIChatClient( | ||
| api_key='', | ||
| endpoint='', | ||
| deployment_name='', | ||
| api_version='', | ||
| ) | ||
|
|
||
| # Register all MCP tools from configured servers | ||
| agent = await service.add_tool_servers_to_agent( | ||
| chat_client=chat_client, | ||
| agent_instructions="You are a helpful assistant with access to various tools.", | ||
| initial_tools=[], # Your existing tools | ||
| agent_user_id="user-123", | ||
| environment_id="prod", | ||
| auth_token="your-token" | ||
| ) | ||
| ``` | ||
|
|
||
| ### How It Works | ||
|
|
||
| The `add_tool_servers_to_agent` method: | ||
|
|
||
| 1. **Discovers MCP Servers**: Uses the MCP server configuration service to find all configured servers | ||
| 2. **Retrieves Tools**: Connects to each server and retrieves available tool definitions | ||
| 3. **Combines Tools**: Merges your existing tools with the MCP tools | ||
| 4. **Creates New Agent**: Returns a new `ChatAgent` instance with all tools configured | ||
|
|
||
| ### Agent Configuration | ||
|
|
||
| Configure agents with different chat clients: | ||
|
|
||
| ```python | ||
| # Using Azure OpenAI (recommended) | ||
| from agent_framework.azure import AzureOpenAIChatClient | ||
|
|
||
| chat_client = AzureOpenAIChatClient( | ||
| api_key='', | ||
| endpoint='', | ||
| deployment_name='', | ||
| api_version='', | ||
| ) | ||
|
|
||
| # Alternative: Using OpenAI directly | ||
| from agent_framework.openai import OpenAIChatClient | ||
| chat_client = OpenAIChatClient() | ||
| ``` | ||
|
|
||
| ## Development | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Python 3.11 or higher | ||
| - Agent Framework Core SDK (`agent-framework-core`) | ||
| - Azure Identity (for authentication) | ||
|
|
||
| ### Development Setup | ||
|
|
||
| 1. Clone the repository | ||
| 2. Install development dependencies: | ||
| ```bash | ||
| pip install -e ".[dev]" | ||
| ``` | ||
| 3. Run tests: | ||
| ```bash | ||
| pytest | ||
| ``` | ||
|
|
||
| ### Code Style | ||
|
|
||
| This project uses: | ||
| - **Black** for code formatting | ||
| - **Ruff** for linting | ||
| - **MyPy** for type checking | ||
|
|
||
| Run the formatter and linter: | ||
| ```bash | ||
| black microsoft_agents_a365/ | ||
| ruff check microsoft_agents_a365/ | ||
| mypy microsoft_agents_a365/ | ||
| ``` | ||
|
|
||
| ## Contributing | ||
|
|
||
| We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for details. | ||
|
|
||
| ## License | ||
|
|
||
| This project is licensed under the MIT License. See the [LICENSE](../../LICENSE.md) file for details. | ||
mrunalhirve128 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Support | ||
|
|
||
| For support and questions: | ||
| - File issues on [GitHub Issues](https://github.com/microsoft/Agent365/issues) | ||
| - Check the [documentation](https://github.com/microsoft/Agent365/tree/main/python) | ||
| - Join the community discussions | ||
|
|
||
| ## Related Libraries | ||
|
|
||
| This library is part of the Microsoft Agent 365 SDK ecosystem: | ||
|
|
||
| - `microsoft-agents-a365-runtime` - Core runtime and utilities | ||
| - `microsoft-agents-a365-tooling` - Base tooling framework | ||
| - `microsoft-agents-a365-tooling-extensions-openai` - OpenAI integration | ||
| - `microsoft-agents-a365-tooling-extensions-semantickernel` - Semantic Kernel integration | ||
| - `microsoft-agents-a365-observability-core` - Observability and monitoring | ||
27 changes: 27 additions & 0 deletions
27
...nsions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Copyright (c) Microsoft. All rights reserved. | ||
mrunalhirve128 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| """ | ||
| Agent 365 Tooling Agent Framework Extensions | ||
|
|
||
| Agent Framework specific tools and services for AI agent development. | ||
| Provides Agent Framework-specific implementations and utilities for | ||
| building agents with Microsoft Agent Framework capabilities. | ||
mrunalhirve128 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Main Service: | ||
| - McpToolRegistrationService: Add MCP tool servers to Agent Framework agents | ||
|
|
||
| This module includes implementations for: | ||
| - Agent Framework agent creation with MCP (Model Context Protocol) server support | ||
| - MCP tool registration service for dynamically adding MCP servers to agents | ||
| - Azure OpenAI and OpenAI chat client integration | ||
| - Authentication and authorization patterns for MCP server discovery | ||
| """ | ||
|
|
||
| __version__ = "1.0.0" | ||
|
|
||
| # Import services from the services module | ||
| from .services import McpToolRegistrationService | ||
|
|
||
| __all__ = [ | ||
| "McpToolRegistrationService", | ||
| ] | ||
14 changes: 14 additions & 0 deletions
14
...entframework/microsoft_agents_a365/tooling/extensions/agentframework/services/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Copyright (c) Microsoft. All rights reserved. | ||
mrunalhirve128 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| """ | ||
| Services module for Agent Framework tooling. | ||
|
|
||
| This package contains service implementations for MCP tool registration | ||
| and management within the Agent Framework. | ||
| """ | ||
|
|
||
| from .mcp_tool_registration_service import McpToolRegistrationService | ||
|
|
||
| __all__ = [ | ||
| "McpToolRegistrationService", | ||
| ] | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.