Skip to content

Commit 259ae2f

Browse files
committed
New README.md updates and core refactoring
1 parent 956853d commit 259ae2f

File tree

9 files changed

+1426
-1397
lines changed

9 files changed

+1426
-1397
lines changed

azurefunctions-agents-framework/README.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,23 @@ GET /api/health # Health check
130130

131131
### A2A Protocol Deployments
132132

133-
Agent-to-Agent (A2A) protocol deployments use A2A specification-compliant endpoints:
133+
Agent-to-Agent (A2A) protocol deployments follow the A2A specification and use JSON-RPC 2.0 over HTTP:
134134

135135
```bash
136-
POST /api/{agent_name}/chat # Chat with the agent (A2A spec)
137-
GET /api/{agent_name}/info # Get agent information (A2A spec)
138-
GET /api/agents # List all available agents
139-
GET /api/health # Health check
136+
POST {agent_url} # JSON-RPC endpoint for all A2A methods
137+
GET /.well-known/agent.json # Agent Card discovery (A2A spec)
138+
GET /api/agents # List all available agents (framework)
139+
GET /api/health # Health check (framework)
140140
```
141141

142+
**A2A JSON-RPC Methods:**
143+
144+
- `message/send` - Send messages to the agent
145+
- `message/stream` - Send messages with streaming responses
146+
- `tasks/get` - Get task status
147+
- `tasks/cancel` - Cancel tasks
148+
- Push notification configuration methods
149+
142150
### Single Agent Example (Weather Bot)
143151

144152
```bash
@@ -178,6 +186,7 @@ curl http://localhost:7071/api/health
178186
```
179187

180188
**Benefits of Unified Routing:**
189+
181190
- Same API pattern works for single and multi-agent deployments
182191
- Easy to migrate from single to multi-agent (just add more agents)
183192
- Predictable and consistent for developers
@@ -214,6 +223,7 @@ app = AgentFunctionApp(
214223
```
215224

216225
**Key Responsibilities:**
226+
217227
- **HTTP Endpoint Management**: Automatically registers routes based on deployment mode
218228
- **Request Routing**: Routes incoming requests to appropriate agents
219229
- **Authentication**: Handles Azure Functions authentication levels
@@ -269,6 +279,7 @@ reflection_agent = ReflectionAgent(
269279
```
270280

271281
**Advanced Capabilities:**
282+
272283
- **Self-Evaluation**: Automatically assesses response quality using configurable criteria
273284
- **Iterative Improvement**: Refines responses through reflection loops
274285
- **Quality Thresholds**: Stops improvement when quality targets are met
@@ -301,6 +312,7 @@ response = await runner.run(chat_request)
301312
```
302313

303314
**Key Responsibilities:**
315+
304316
- **Input Normalization**: Accepts strings, dicts, or structured Request objects
305317
- **Agent Execution**: Runs agents and handles async/sync execution patterns
306318
- **Response Generation**: Returns structured Response objects
@@ -335,6 +347,7 @@ response_dict = response.to_dict()
335347
```
336348

337349
**Benefits:**
350+
338351
- **Type Safety**: Full type hints and validation
339352
- **Clean Separation**: Business logic separate from HTTP/transport concerns
340353
- **Testability**: Easy to test without HTTP infrastructure
@@ -343,9 +356,10 @@ response_dict = response.to_dict()
343356
### Architecture Patterns
344357

345358
#### Single-Agent Pattern
359+
346360
**Best for:** Focused, specialized applications
347361

348-
```
362+
```text
349363
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
350364
│ HTTP Request │───▶│ AgentFunctionApp │───▶│ Single Agent │
351365
│ │ │ (Routing) │ │ (Processing) │
@@ -364,9 +378,10 @@ response_dict = response.to_dict()
364378
- `GET /api/agents/{AgentName}/info` - Get agent information
365379

366380
#### Multi-Agent Pattern
381+
367382
**Best for:** Complex workflows requiring specialized agents
368383

369-
```
384+
```text
370385
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
371386
│ HTTP Request │───▶│ AgentFunctionApp │───▶│ Agent Router │
372387
│ │ │ (Multi-mode) │ │ │
@@ -390,25 +405,26 @@ response_dict = response.to_dict()
390405

391406
#### 1. Request Processing Flow
392407

393-
```
408+
```text
394409
HTTP Request → AgentFunctionApp → Agent.process_request() → LLM + Tools → Response
395410
```
396411

397412
#### 2. Tool Execution Flow
398413

399-
```
414+
```text
400415
Agent → ToolRegistry → [FunctionTool | MCPTool] → Result → LLM → Final Response
401416
```
402417

403418
#### 3. Reflection Flow (ReflectionAgent)
404419

405-
```
420+
```text
406421
Initial Response → Self-Evaluation → Reflection → Improvement → Quality Check → Final Response
407422
```
408423

409424
### Extensibility Points
410425

411426
#### Custom Agent Types
427+
412428
Extend the base `Agent` class to create specialized agent behaviors:
413429

414430
```python
@@ -421,6 +437,7 @@ class CustomAgent(Agent):
421437
```
422438

423439
#### Custom Tools
440+
424441
Register functions as tools using the decorator pattern:
425442

426443
```python
@@ -431,6 +448,7 @@ def my_custom_tool(param: str) -> str:
431448
```
432449

433450
#### MCP Server Integration
451+
434452
Connect to external MCP servers for enhanced capabilities:
435453

436454
```python
@@ -497,6 +515,18 @@ Connect your agents to MCP servers for enhanced capabilities:
497515
from azurefunctions.agents import Agent, MCPServer, MCPServerMode
498516
from azurefunctions.agents import MCPServerSseParams
499517

518+
```python
519+
from azurefunctions.agents import Agent, MCPServer, MCPServerMode
520+
from azurefunctions.agents import MCPServerSseParams
521+
from azurefunctions.agents.types import LLMConfig, LLMProvider
522+
523+
# Configure LLM for the agent
524+
llm_config = LLMConfig(
525+
provider=LLMProvider.OPENAI,
526+
model_name="gpt-4",
527+
api_key="your-openai-api-key"
528+
)
529+
500530
# Configure MCP server (SSE mode example)
501531
mcp_server = MCPServer(
502532
name="CodeExecutionMCPServer",
@@ -529,6 +559,7 @@ The unified `MCPServer` supports three communication modes:
529559
**STDIO Mode** (subprocess communication):
530560

531561
```python
562+
from azurefunctions.agents import MCPServer, MCPServerMode
532563
from azurefunctions.agents import MCPServerStdioParams
533564

534565
mcp_server = MCPServer(
@@ -545,6 +576,7 @@ mcp_server = MCPServer(
545576
**SSE Mode** (Server-Sent Events):
546577

547578
```python
579+
from azurefunctions.agents import MCPServer, MCPServerMode
548580
from azurefunctions.agents import MCPServerSseParams
549581

550582
mcp_server = MCPServer(
@@ -560,6 +592,7 @@ mcp_server = MCPServer(
560592
**Streamable HTTP Mode**:
561593

562594
```python
595+
from azurefunctions.agents import MCPServer, MCPServerMode
563596
from azurefunctions.agents import MCPServerStreamableHttpParams
564597

565598
mcp_server = MCPServer(

azurefunctions-agents-framework/azurefunctions/agents/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
Core agent framework for building intelligent Azure Functions with AI capabilities.
77
"""
88

9-
from .core import Agent, AgentFunctionApp, ReflectionAgent
9+
from .agents import Agent, ReflectionAgent
10+
from .core import AgentFunctionApp
1011
from .mcp import (
1112
MCPServer,
1213
MCPServerMode,
13-
MCPServerStdioParams,
1414
MCPServerSseParams,
15+
MCPServerStdioParams,
1516
MCPServerStreamableHttpParams,
1617
MCPUtil,
1718
)
@@ -44,6 +45,6 @@
4445
"MCPUtil",
4546
]
4647

47-
__version__ = "0.0.1a1"
48+
__version__ = "0.0.1a2"
4849
__author__ = "Microsoft Azure Functions Team"
4950
__license__ = "MIT"

0 commit comments

Comments
 (0)