Skip to content

Commit 7d7ae9c

Browse files
Merge pull request #5 from microsoft/users/mrunalhirve/AgentFrameworkSDKInPython
Agent Framework SDK
2 parents e06a40a + 06d695f commit 7d7ae9c

14 files changed

Lines changed: 994 additions & 121 deletions

File tree

libraries/microsoft-agents-a365-observability-core/pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ classifiers = [
2525
license = "MIT"
2626
keywords = ["observability", "telemetry", "tracing", "opentelemetry", "monitoring", "ai", "agents"]
2727
dependencies = [
28-
"opentelemetry-api >= 1.20.0",
29-
"opentelemetry-sdk >= 1.20.0",
30-
"opentelemetry-exporter-otlp >= 1.20.0",
28+
"opentelemetry-api >= 1.36.0",
29+
"opentelemetry-sdk >= 1.36.0",
30+
"opentelemetry-exporter-otlp >= 1.36.0",
3131
"pydantic >= 2.0.0",
3232
"typing-extensions >= 4.0.0",
3333
"microsoft-agents-a365-runtime >= 2025.10.16"
@@ -45,8 +45,9 @@ azure = [
4545
"azure-identity >= 1.12.0",
4646
"azure-monitor-ingestion >= 1.0.0",
4747
]
48+
# Modern approach: use OTLP exporter to send to Jaeger (since Jaeger v1.35+ supports OTLP natively)
4849
jaeger = [
49-
"opentelemetry-exporter-jaeger >= 1.20.0",
50+
"opentelemetry-exporter-otlp-proto-grpc >= 1.36.0",
5051
]
5152
dev = [
5253
"pytest >= 7.0.0",

libraries/microsoft-agents-a365-observability-extensions-langchain/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ dependencies = [
2828
"microsoft-agents-a365-observability-core >= 2025.10.16",
2929
"langchain >= 0.1.0",
3030
"langchain-core >= 0.1.0",
31-
"opentelemetry-api >= 1.20.0",
32-
"opentelemetry-sdk >= 1.20.0",
33-
"opentelemetry-instrumentation >= 0.41b0",
31+
"opentelemetry-api >= 1.36.0",
32+
"opentelemetry-sdk >= 1.36.0",
33+
"opentelemetry-instrumentation >= 0.47b0",
3434
]
3535

3636
[project.urls]

libraries/microsoft-agents-a365-observability-extensions-openai/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ keywords = ["observability", "telemetry", "tracing", "opentelemetry", "openai",
2727
dependencies = [
2828
"microsoft-agents-a365-observability-core >= 2025.10.16",
2929
"openai-agents >= 0.2.6",
30-
"opentelemetry-api >= 1.20.0",
31-
"opentelemetry-sdk >= 1.20.0",
32-
"opentelemetry-instrumentation >= 0.41b0",
30+
"opentelemetry-api >= 1.36.0",
31+
"opentelemetry-sdk >= 1.36.0",
32+
"opentelemetry-instrumentation >= 0.47b0",
3333
]
3434

3535
[project.urls]

libraries/microsoft-agents-a365-observability-extensions-semantickernel/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ keywords = ["observability", "telemetry", "tracing", "opentelemetry", "semantic-
2727
dependencies = [
2828
"microsoft-agents-a365-observability-core >= 2025.10.16",
2929
"semantic-kernel >= 1.0.0",
30-
"opentelemetry-api >= 1.20.0",
31-
"opentelemetry-sdk >= 1.20.0",
32-
"opentelemetry-instrumentation >= 0.41b0",
30+
"opentelemetry-api >= 1.36.0",
31+
"opentelemetry-sdk >= 1.36.0",
32+
"opentelemetry-instrumentation >= 0.47b0",
3333
]
3434

3535
[project.urls]
Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
# Microsoft Agent 365 Tooling Extensions - Agent Framework
2+
[![PyPI version](https://badge.fury.io/py/microsoft-agents-a365-tooling-extensions-agentframework.svg)](https://badge.fury.io/py/microsoft-agents-a365-tooling-extensions-agentframework)
3+
4+
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.
5+
6+
## What is this?
7+
8+
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.
9+
10+
## Key Features
11+
12+
**Agent Framework Integration** - Native integration with Microsoft Agent Framework
13+
**MCP Tool Registration** - Automatic registration of MCP servers with Agent Framework agents
14+
**Azure Identity Support** - Built-in Azure authentication with DefaultAzureCredential
15+
**Tool Resource Management** - Comprehensive management of tool definitions and resources
16+
**Multi-Environment Support** - Support for development and production deployment scenarios
17+
**Enterprise Ready** - Production-grade tooling for Agent Framework-based agent deployments
18+
19+
## Installation
20+
21+
```bash
22+
pip install microsoft-agents-a365-tooling-extensions-agentframework
23+
```
24+
25+
### Prerequisites
26+
27+
The Agent Framework tooling extensions require the Agent Framework Core package:
28+
29+
```bash
30+
# Core Agent Framework (includes Azure OpenAI and OpenAI support by default)
31+
# also includes workflows and orchestrations
32+
pip install agent-framework-core --pre
33+
```
34+
35+
**Optional Agent Framework packages:**
36+
```bash
37+
# Core + Azure AI integration
38+
pip install agent-framework-azure-ai --pre
39+
40+
# Core + Microsoft Copilot Studio integration
41+
pip install agent-framework-copilotstudio --pre
42+
43+
# Core + both Microsoft Copilot Studio and Azure AI integration
44+
pip install agent-framework-microsoft agent-framework-azure-ai --pre
45+
```
46+
47+
## Quick Start
48+
49+
### Basic Concepts
50+
51+
The Microsoft Agent 365 Agent Framework Tooling Extensions enable seamless integration between MCP tool servers and Agent Framework agents. Key concepts include:
52+
53+
- **MCP Tool Registration**: Automatic registration of tool definitions with Agent Framework
54+
- **Agent Resource Management**: Management of agent resources and configurations
55+
- **Tool Discovery**: Dynamic discovery and registration of available tools
56+
- **Service Integration**: Integration with various service providers and backends
57+
58+
### Basic Usage
59+
60+
```python
61+
import asyncio
62+
from agent_framework import ChatAgent
63+
from agent_framework.azure import AzureOpenAIChatClient
64+
from microsoft_agents_a365.tooling.extensions.agentframework import (
65+
McpToolRegistrationService,
66+
)
67+
68+
async def main():
69+
# Initialize the MCP tool registration service
70+
service = McpToolRegistrationService()
71+
72+
# Create Azure OpenAI chat client
73+
chat_client = AzureOpenAIChatClient(
74+
api_key='',
75+
endpoint='',
76+
deployment_name='',
77+
api_version='',
78+
)
79+
80+
# Create agent with MCP tools from all configured servers
81+
agent = await service.add_tool_servers_to_agent(
82+
chat_client=chat_client,
83+
agent_instructions="You are a helpful assistant that can provide weather and restaurant information.",
84+
initial_tools=[], # Your existing tools
85+
agent_user_id="user-123",
86+
environment_id="prod",
87+
auth_token="your-auth-token"
88+
)
89+
90+
if __name__ == "__main__":
91+
asyncio.run(main())
92+
```
93+
94+
### Advanced Configuration
95+
96+
```python
97+
import asyncio
98+
from agent_framework import ChatAgent
99+
from agent_framework.azure import AzureOpenAIChatClient
100+
from microsoft_agents_a365.tooling.extensions.agentframework import (
101+
McpToolRegistrationService,
102+
)
103+
104+
async def main():
105+
# Initialize with custom logger
106+
import logging
107+
108+
logger = logging.getLogger("my-agent")
109+
110+
service = McpToolRegistrationService(
111+
logger=logger
112+
)
113+
114+
# Create Azure OpenAI chat client
115+
chat_client = AzureOpenAIChatClient(
116+
api_key='',
117+
endpoint='',
118+
deployment_name='',
119+
api_version='',
120+
)
121+
122+
# Define existing tools (if any)
123+
existing_tools = [
124+
# Your existing tools go here
125+
]
126+
127+
# Create agent with comprehensive instructions and all MCP tools
128+
agent = await service.add_tool_servers_to_agent(
129+
chat_client=chat_client,
130+
agent_instructions="""
131+
You are a helpful AI assistant with access to various tools and services.
132+
133+
Guidelines:
134+
1) Always be helpful and accurate
135+
2) Use available tools when appropriate to provide better assistance
136+
3) Explain your reasoning when using tools
137+
138+
You have access to MCP (Model Context Protocol) tools that are automatically
139+
loaded from configured servers. Use these tools to enhance your capabilities.
140+
""",
141+
initial_tools=existing_tools,
142+
agent_user_id="user-123",
143+
environment_id="production",
144+
auth_token="your-auth-token"
145+
)
146+
147+
# The agent now has all MCP tools from configured servers
148+
print(f"Agent created with {len(agent.tools)} total tools")
149+
150+
if __name__ == "__main__":
151+
asyncio.run(main())
152+
```
153+
154+
## Configuration
155+
156+
The library supports various configuration options through environment variables:
157+
158+
- `AGENT_FRAMEWORK_ENDPOINT`: The Agent Framework endpoint URL
159+
- `AGENT_FRAMEWORK_API_KEY`: API key for Agent Framework authentication
160+
- `MCP_TOOLS_DIRECTORY`: Directory containing MCP tool definitions
161+
- `AGENT_ENVIRONMENT`: Deployment environment (development, staging, production)
162+
163+
## Agent Framework Integration
164+
165+
This library provides deep integration with Microsoft Agent Framework using the `ChatAgent` pattern:
166+
167+
### MCP Tool Server Registration
168+
169+
Automatically register MCP tools from all configured servers with your Agent Framework agents:
170+
171+
```python
172+
from agent_framework import ChatAgent
173+
from agent_framework.azure import AzureOpenAIChatClient
174+
from microsoft_agents_a365.tooling.extensions.agentframework import (
175+
McpToolRegistrationService,
176+
)
177+
178+
service = McpToolRegistrationService()
179+
180+
# Create Azure OpenAI chat client
181+
chat_client = AzureOpenAIChatClient(
182+
api_key='',
183+
endpoint='',
184+
deployment_name='',
185+
api_version='',
186+
)
187+
188+
# Register all MCP tools from configured servers
189+
agent = await service.add_tool_servers_to_agent(
190+
chat_client=chat_client,
191+
agent_instructions="You are a helpful assistant with access to various tools.",
192+
initial_tools=[], # Your existing tools
193+
agent_user_id="user-123",
194+
environment_id="prod",
195+
auth_token="your-token"
196+
)
197+
```
198+
199+
### How It Works
200+
201+
The `add_tool_servers_to_agent` method:
202+
203+
1. **Discovers MCP Servers**: Uses the MCP server configuration service to find all configured servers
204+
2. **Retrieves Tools**: Connects to each server and retrieves available tool definitions
205+
3. **Combines Tools**: Merges your existing tools with the MCP tools
206+
4. **Creates New Agent**: Returns a new `ChatAgent` instance with all tools configured
207+
208+
### Agent Configuration
209+
210+
Configure agents with different chat clients:
211+
212+
```python
213+
# Using Azure OpenAI (recommended)
214+
from agent_framework.azure import AzureOpenAIChatClient
215+
216+
chat_client = AzureOpenAIChatClient(
217+
api_key='',
218+
endpoint='',
219+
deployment_name='',
220+
api_version='',
221+
)
222+
223+
# Alternative: Using OpenAI directly
224+
from agent_framework.openai import OpenAIChatClient
225+
chat_client = OpenAIChatClient()
226+
```
227+
228+
## Development
229+
230+
### Prerequisites
231+
232+
- Python 3.11 or higher
233+
- Agent Framework Core SDK (`agent-framework-core`)
234+
- Azure Identity (for authentication)
235+
236+
### Development Setup
237+
238+
1. Clone the repository
239+
2. Install development dependencies:
240+
```bash
241+
pip install -e ".[dev]"
242+
```
243+
3. Run tests:
244+
```bash
245+
pytest
246+
```
247+
248+
### Code Style
249+
250+
This project uses:
251+
- **Black** for code formatting
252+
- **Ruff** for linting
253+
- **MyPy** for type checking
254+
255+
Run the formatter and linter:
256+
```bash
257+
black microsoft_agents_a365/
258+
ruff check microsoft_agents_a365/
259+
mypy microsoft_agents_a365/
260+
```
261+
262+
## Contributing
263+
264+
We welcome contributions! Feel free to open issues or submit pull requests to help improve this project.
265+
266+
## License
267+
268+
This project is licensed under the MIT License. See the [LICENSE](https://github.com/microsoft/Agent365/blob/main/LICENSE.md) file for details.
269+
270+
## Support
271+
272+
For support and questions:
273+
- File issues on [GitHub Issues](https://github.com/microsoft/Agent365/issues)
274+
- Check the [documentation](https://github.com/microsoft/Agent365/tree/main/python)
275+
- Join the community discussions
276+
277+
## Related Libraries
278+
279+
This library is part of the Microsoft Agent 365 SDK ecosystem:
280+
281+
- `microsoft-agents-a365-runtime` - Core runtime and utilities
282+
- `microsoft-agents-a365-tooling` - Base tooling framework
283+
- `microsoft-agents-a365-tooling-extensions-openai` - OpenAI integration
284+
- `microsoft-agents-a365-tooling-extensions-semantickernel` - Semantic Kernel integration
285+
- `microsoft-agents-a365-observability-core` - Observability and monitoring
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) Microsoft. All rights reserved.
2+
3+
"""
4+
Agent 365 Tooling Agent Framework Extensions
5+
6+
Agent Framework specific tools and services for AI agent development.
7+
Provides Agent Framework-specific implementations and utilities for
8+
building agents with Microsoft Agent Framework capabilities.
9+
10+
Main Service:
11+
- McpToolRegistrationService: Add MCP tool servers to Agent Framework agents
12+
13+
This module includes implementations for:
14+
- Agent Framework agent creation with MCP (Model Context Protocol) server support
15+
- MCP tool registration service for dynamically adding MCP servers to agents
16+
- Azure OpenAI and OpenAI chat client integration
17+
- Authentication and authorization patterns for MCP server discovery
18+
"""
19+
20+
__version__ = "1.0.0"
21+
22+
# Import services from the services module
23+
from .services import McpToolRegistrationService
24+
25+
__all__ = [
26+
"McpToolRegistrationService",
27+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) Microsoft. All rights reserved.
2+
3+
"""
4+
Services module for Agent Framework tooling.
5+
6+
This package contains service implementations for MCP tool registration
7+
and management within the Agent Framework.
8+
"""
9+
10+
from .mcp_tool_registration_service import McpToolRegistrationService
11+
12+
__all__ = [
13+
"McpToolRegistrationService",
14+
]

0 commit comments

Comments
 (0)