azurefunctions-agents-runtime 0.0.0.dev1__tar.gz → 0.0.0.dev3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {azurefunctions_agents_runtime-0.0.0.dev1/src/azurefunctions_agents_runtime.egg-info → azurefunctions_agents_runtime-0.0.0.dev3}/PKG-INFO +148 -54
- azurefunctions_agents_runtime-0.0.0.dev1/PKG-INFO → azurefunctions_agents_runtime-0.0.0.dev3/README.md +139 -67
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/pyproject.toml +12 -4
- azurefunctions_agents_runtime-0.0.0.dev3/src/azure_functions_agents/__init__.py +59 -0
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azure_functions_agents/app.py +104 -46
- azurefunctions_agents_runtime-0.0.0.dev3/src/azure_functions_agents/client_manager.py +239 -0
- azurefunctions_agents_runtime-0.0.0.dev3/src/azure_functions_agents/config.py +305 -0
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azure_functions_agents/connector_tool_cache.py +15 -6
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azure_functions_agents/connector_tools.py +114 -73
- azurefunctions_agents_runtime-0.0.0.dev3/src/azure_functions_agents/mcp.py +141 -0
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azure_functions_agents/public/index.html +26 -26
- azurefunctions_agents_runtime-0.0.0.dev3/src/azure_functions_agents/runner.py +450 -0
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azure_functions_agents/sandbox.py +75 -56
- azurefunctions_agents_runtime-0.0.0.dev3/src/azure_functions_agents/skills.py +77 -0
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azure_functions_agents/tools.py +79 -37
- azurefunctions_agents_runtime-0.0.0.dev1/README.md → azurefunctions_agents_runtime-0.0.0.dev3/src/azurefunctions_agents_runtime.egg-info/PKG-INFO +161 -50
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azurefunctions_agents_runtime.egg-info/SOURCES.txt +1 -2
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azurefunctions_agents_runtime.egg-info/requires.txt +7 -1
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azurefunctions_agents_runtime.egg-info/top_level.txt +0 -1
- azurefunctions_agents_runtime-0.0.0.dev1/src/azure_functions_agents/__init__.py +0 -20
- azurefunctions_agents_runtime-0.0.0.dev1/src/azure_functions_agents/client_manager.py +0 -84
- azurefunctions_agents_runtime-0.0.0.dev1/src/azure_functions_agents/config.py +0 -191
- azurefunctions_agents_runtime-0.0.0.dev1/src/azure_functions_agents/mcp.py +0 -87
- azurefunctions_agents_runtime-0.0.0.dev1/src/azure_functions_agents/runner.py +0 -406
- azurefunctions_agents_runtime-0.0.0.dev1/src/azure_functions_agents/skills.py +0 -24
- azurefunctions_agents_runtime-0.0.0.dev1/src/copilot_functions/__init__.py +0 -3
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/LICENSE.md +0 -0
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/setup.cfg +0 -0
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azure_functions_agents/arm.py +0 -0
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azure_functions_agents/connectors.py +0 -0
- {azurefunctions_agents_runtime-0.0.0.dev1 → azurefunctions_agents_runtime-0.0.0.dev3}/src/azurefunctions_agents_runtime.egg-info/dependency_links.txt +0 -0
|
@@ -1,48 +1,52 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: azurefunctions-agents-runtime
|
|
3
|
-
Version: 0.0.0.
|
|
4
|
-
Summary: A markdown-first programming model for building AI agents on Azure Functions
|
|
3
|
+
Version: 0.0.0.dev3
|
|
4
|
+
Summary: A markdown-first programming model for building AI agents on Azure Functions, powered by the Microsoft Agent Framework.
|
|
5
5
|
License: MIT
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.13
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE.md
|
|
9
9
|
Requires-Dist: azure-functions>=1.24.0
|
|
10
|
-
Requires-Dist:
|
|
10
|
+
Requires-Dist: agent-framework-core>=1.2.2
|
|
11
|
+
Requires-Dist: agent-framework-openai>=1.2.2
|
|
12
|
+
Requires-Dist: agent-framework-foundry>=1.2.2
|
|
11
13
|
Requires-Dist: pydantic>=2.0.0
|
|
12
14
|
Requires-Dist: python-frontmatter>=1.1.0
|
|
13
15
|
Requires-Dist: azurefunctions-extensions-http-fastapi
|
|
14
16
|
Requires-Dist: aiohttp>=3.9.0
|
|
15
17
|
Requires-Dist: azure-identity>=1.15.0
|
|
18
|
+
Requires-Dist: mcp>=1.0.0
|
|
19
|
+
Provides-Extra: connectors
|
|
20
|
+
Requires-Dist: azure-connectors; extra == "connectors"
|
|
16
21
|
Dynamic: license-file
|
|
17
22
|
|
|
18
23
|
# azure-functions-agents (Experimental)
|
|
19
24
|
|
|
20
25
|
> **⚠️ This is an experimental package.** The APIs described here are under active development and subject to change.
|
|
21
26
|
|
|
22
|
-
A markdown-first programming model for building AI agents on Azure Functions
|
|
27
|
+
A markdown-first programming model for building AI agents on Azure Functions, powered by the [Microsoft Agent Framework (MAF)](https://github.com/microsoft/agent-framework).
|
|
23
28
|
|
|
24
|
-
- **Build agents with markdown** — write instructions, configure triggers, and bind tools in
|
|
29
|
+
- **Build agents with markdown** — write instructions, configure triggers, and bind tools in `.agent.md` files
|
|
25
30
|
- **Run on any Azure Functions trigger** — trigger agents on timer, queue, blob, HTTP, Event Hub, Service Bus, Cosmos DB, and more
|
|
26
31
|
- **Connect to 1,400+ services** — Azure API Connections let agents trigger on and perform actions across Office 365, Teams, SQL, Salesforce, SAP, and hundreds of other connectors — no custom code required
|
|
27
|
-
- **Extend with MCP servers** — plug in remote HTTP MCP servers for additional capabilities
|
|
28
|
-
- **Build custom tools in plain Python** —
|
|
32
|
+
- **Extend with MCP servers** — plug in remote HTTP MCP servers and stdio MCP servers for additional capabilities
|
|
33
|
+
- **Build custom tools in plain Python** — drop a `.py` file in `tools/`, decorate functions with `@tool`, and pull in any package you need
|
|
29
34
|
- **Automatic HTTP and MCP endpoints** — optionally expose your agent as an HTTP chat API and MCP server with no extra code
|
|
30
|
-
- **Serverless with built-in session management** — scales to zero, persists multi-turn conversations
|
|
35
|
+
- **Serverless with built-in session management** — scales to zero, persists multi-turn conversations on Azure Files
|
|
36
|
+
- **Pluggable model providers** — bring OpenAI, Azure OpenAI, or Azure AI Foundry credentials and the runtime auto-detects the right client
|
|
31
37
|
|
|
32
38
|
## Installation
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Install directly from the release URL:
|
|
40
|
+
The package is published on PyPI as **`azurefunctions-agents-runtime`**.
|
|
37
41
|
|
|
38
42
|
```bash
|
|
39
|
-
pip install
|
|
43
|
+
pip install azurefunctions-agents-runtime
|
|
40
44
|
```
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
Add it to your function app's `requirements.txt`:
|
|
43
47
|
|
|
44
|
-
```
|
|
45
|
-
|
|
48
|
+
```
|
|
49
|
+
azurefunctions-agents-runtime
|
|
46
50
|
```
|
|
47
51
|
|
|
48
52
|
### With connector tools support
|
|
@@ -50,23 +54,52 @@ pip install azure-functions-agents @ git+https://github.com/anthonychu/azure-fun
|
|
|
50
54
|
Connector tools (Teams, Office 365, SQL, Salesforce, etc.) require an optional extra:
|
|
51
55
|
|
|
52
56
|
```bash
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
pip install "azurefunctions-agents-runtime[connectors]"
|
|
58
|
+
```
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
### From source (development)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install azurefunctions-agents-runtime @ git+https://github.com/anthonychu/azure-functions-agents.git
|
|
58
64
|
```
|
|
59
65
|
|
|
60
|
-
##
|
|
66
|
+
## Model Provider Configuration
|
|
67
|
+
|
|
68
|
+
The runtime uses Microsoft Agent Framework, which supports OpenAI, Azure OpenAI, and Azure AI Foundry as inference back-ends. Auto-detection picks the first provider whose env vars are set, in this order:
|
|
61
69
|
|
|
62
|
-
|
|
70
|
+
1. `AZURE_OPENAI_ENDPOINT` → Azure OpenAI
|
|
71
|
+
2. `FOUNDRY_PROJECT_ENDPOINT` → Azure AI Foundry
|
|
72
|
+
3. `OPENAI_API_KEY` → OpenAI
|
|
63
73
|
|
|
64
|
-
|
|
65
|
-
2. Give the token a name (e.g. `azure-functions-agents`)
|
|
66
|
-
3. Under **Permissions**, select **Add permissions**, then select **Copilot requests**, and set it to **Read-only**
|
|
67
|
-
4. Click **Generate token** and copy the value
|
|
74
|
+
You can pin the provider explicitly with `MAF_PROVIDER=openai|azure_openai|foundry`.
|
|
68
75
|
|
|
69
|
-
|
|
76
|
+
| Provider | Required env vars | Notes |
|
|
77
|
+
| ----------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
78
|
+
| OpenAI | `OPENAI_API_KEY`, optional `MAF_MODEL` (default `gpt-4o-mini`) | |
|
|
79
|
+
| Azure OpenAI | `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_DEPLOYMENT`, optional `AZURE_OPENAI_API_VERSION` | If `AZURE_OPENAI_API_KEY` is omitted the SDK uses `DefaultAzureCredential` (AAD). |
|
|
80
|
+
| Azure AI Foundry | `FOUNDRY_PROJECT_ENDPOINT`, optional `FOUNDRY_MODEL` | Always uses `DefaultAzureCredential`. |
|
|
81
|
+
|
|
82
|
+
`MAF_MODEL` overrides the per-provider default when set.
|
|
83
|
+
|
|
84
|
+
### Plugging in a custom client manager
|
|
85
|
+
|
|
86
|
+
Provider auto-detection lives behind a small interface. To integrate a new chat client, implement `ClientManager` and register your instance once at startup:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from azure_functions_agents import ClientManager, set_client_manager
|
|
90
|
+
|
|
91
|
+
class MyCustomClientManager(ClientManager):
|
|
92
|
+
def resolve_model(self, model_override=None):
|
|
93
|
+
return model_override or "my-model"
|
|
94
|
+
def build_chat_client(self, model_override=None):
|
|
95
|
+
return MyChatClient(model=self.resolve_model(model_override))
|
|
96
|
+
async def close(self):
|
|
97
|
+
...
|
|
98
|
+
|
|
99
|
+
set_client_manager(MyCustomClientManager())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Once set, every call to `run_agent` / `run_agent_stream` and every triggered agent uses your client.
|
|
70
103
|
|
|
71
104
|
## Quick Start
|
|
72
105
|
|
|
@@ -93,7 +126,7 @@ from azure_functions_agents import create_function_app
|
|
|
93
126
|
app = create_function_app()
|
|
94
127
|
```
|
|
95
128
|
|
|
96
|
-
> The app root is auto-detected from `AzureWebJobsScriptRoot` (set by `func start` and the Azure Functions host). You can override it with `create_function_app(app_root=Path(__file__).parent)` or the `
|
|
129
|
+
> The app root is auto-detected from `AzureWebJobsScriptRoot` (set by `func start` and the Azure Functions host). You can override it with `create_function_app(app_root=Path(__file__).parent)` or the `AZURE_FUNCTIONS_AGENTS_APP_ROOT` env var.
|
|
97
130
|
|
|
98
131
|
### 3. Create `host.json`
|
|
99
132
|
|
|
@@ -115,34 +148,38 @@ app = create_function_app()
|
|
|
115
148
|
### 4. Create `requirements.txt`
|
|
116
149
|
|
|
117
150
|
```
|
|
118
|
-
|
|
151
|
+
azurefunctions-agents-runtime
|
|
119
152
|
```
|
|
120
153
|
|
|
121
|
-
Or use
|
|
154
|
+
Or use `azurefunctions-agents-runtime[connectors]` to enable the optional connector tools extra.
|
|
122
155
|
|
|
123
|
-
### 5.
|
|
156
|
+
### 5. Set the model provider
|
|
124
157
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
docker run -d --name azurite -p 10000:10000 -p 10001:10001 -p 10002:10002 \
|
|
129
|
-
mcr.microsoft.com/azure-storage/azurite \
|
|
130
|
-
azurite --skipApiVersionCheck --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Then set the storage connection string in `local.settings.json`:
|
|
158
|
+
For local development with OpenAI:
|
|
134
159
|
|
|
135
160
|
```json
|
|
136
161
|
{
|
|
137
162
|
"IsEncrypted": false,
|
|
138
163
|
"Values": {
|
|
139
164
|
"FUNCTIONS_WORKER_RUNTIME": "python",
|
|
140
|
-
"AzureWebJobsStorage": "UseDevelopmentStorage=true"
|
|
165
|
+
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
|
|
166
|
+
"OPENAI_API_KEY": "sk-...",
|
|
167
|
+
"MAF_MODEL": "gpt-4o-mini"
|
|
141
168
|
}
|
|
142
169
|
}
|
|
143
170
|
```
|
|
144
171
|
|
|
145
|
-
### 6.
|
|
172
|
+
### 6. Start Azurite (local storage emulator)
|
|
173
|
+
|
|
174
|
+
The MCP server endpoint and non-HTTP triggers (timer, queue, blob, etc.) require a storage account. Locally, use [Azurite](https://learn.microsoft.com/azure/storage/common/storage-use-azurite) via Docker:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
docker run -d --name azurite -p 10000:10000 -p 10001:10001 -p 10002:10002 \
|
|
178
|
+
mcr.microsoft.com/azure-storage/azurite \
|
|
179
|
+
azurite --skipApiVersionCheck --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 7. Run locally
|
|
146
183
|
|
|
147
184
|
```bash
|
|
148
185
|
func start
|
|
@@ -159,7 +196,7 @@ Define an agent with a markdown file. When `main.agent.md` is present, the runti
|
|
|
159
196
|
- **Chat UI** — built-in single-page web interface at the app root
|
|
160
197
|
- **HTTP APIs** — `POST /agent/chat` (JSON) and `POST /agent/chatstream` (SSE)
|
|
161
198
|
- **MCP server** — `/runtime/webhooks/mcp` for VS Code, Claude Desktop, etc.
|
|
162
|
-
- **Session persistence** — multi-turn conversations stored on Azure Files
|
|
199
|
+
- **Session persistence** — multi-turn conversations stored on Azure Files via MAF's `FileHistoryProvider`
|
|
163
200
|
|
|
164
201
|
### Event-driven agents (`<name>.agent.md`)
|
|
165
202
|
|
|
@@ -170,11 +207,11 @@ Define event-triggered agents with `.agent.md` files. Each file corresponds to a
|
|
|
170
207
|
|
|
171
208
|
### Shared capabilities
|
|
172
209
|
- **Markdown-first** — agent instructions, trigger config, and tool bindings in `.agent.md` files
|
|
173
|
-
- **Skills** — reusable prompt modules from
|
|
174
|
-
- **Custom tools** — drop a `.py` file in `tools
|
|
210
|
+
- **Skills** — reusable prompt modules from `*.md` files under `skills/`
|
|
211
|
+
- **Custom tools** — drop a `.py` file in `tools/`, decorate functions with `@tool`, and they become callable
|
|
175
212
|
- **Connector tools** — dynamically generated tools from Azure API Connections
|
|
176
|
-
- **MCP servers** — connect to external MCP servers for additional tools
|
|
177
|
-
- **Sandbox** — code execution via Azure Container Apps dynamic sessions
|
|
213
|
+
- **MCP servers** — connect to external MCP servers (HTTP or stdio) for additional tools
|
|
214
|
+
- **Sandbox** — Python code execution via Azure Container Apps dynamic sessions
|
|
178
215
|
|
|
179
216
|
## Agent File Format (`.agent.md`)
|
|
180
217
|
|
|
@@ -213,6 +250,8 @@ response_example: | # optional — agent returns structured JSON matching
|
|
|
213
250
|
Agent instructions in markdown...
|
|
214
251
|
```
|
|
215
252
|
|
|
253
|
+
> **Note**: Earlier preview releases supported a `runtime: copilot|maf` frontmatter field. As of 1.0.0 only Microsoft Agent Framework is used and the field is ignored (with a one-time warning per agent file). Remove it from your `.agent.md` files.
|
|
254
|
+
|
|
216
255
|
### Multiple functions from markdown
|
|
217
256
|
|
|
218
257
|
- **`main.agent.md`** — creates HTTP chat, MCP, and UI endpoints. No other triggers are supported in this file.
|
|
@@ -308,6 +347,22 @@ substitute_variables: false
|
|
|
308
347
|
Instructions with literal $VAR references that should not be replaced.
|
|
309
348
|
```
|
|
310
349
|
|
|
350
|
+
## Custom Python tools
|
|
351
|
+
|
|
352
|
+
Drop a `.py` file in `tools/` and decorate functions with `@tool`. The runtime auto-discovers them at import time and adds them to every agent.
|
|
353
|
+
|
|
354
|
+
```python
|
|
355
|
+
# tools/my_tools.py
|
|
356
|
+
from azure_functions_agents import tool
|
|
357
|
+
|
|
358
|
+
@tool
|
|
359
|
+
def reverse_string(text: str) -> str:
|
|
360
|
+
"""Reverse the input string."""
|
|
361
|
+
return text[::-1]
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
`@tool` is re-exported from `agent_framework`. Functions can be sync or async; types in the signature feed MAF's automatic JSON-Schema generation. Tools that need richer schemas can be declared with `agent_framework.FunctionTool` directly.
|
|
365
|
+
|
|
311
366
|
## What `main.agent.md` Enables
|
|
312
367
|
|
|
313
368
|
When a `main.agent.md` file exists in your app root, the runtime automatically registers:
|
|
@@ -323,7 +378,7 @@ On first load, you'll be prompted for the base URL and a function key (for deplo
|
|
|
323
378
|
Two POST endpoints for programmatic access:
|
|
324
379
|
|
|
325
380
|
- **`POST /agent/chat`** — JSON request/response. Returns `session_id`, `response`, and `tool_calls`.
|
|
326
|
-
- **`POST /agent/chatstream`** — streaming Server-Sent Events (SSE).
|
|
381
|
+
- **`POST /agent/chatstream`** — streaming Server-Sent Events (SSE). Events include `session`, `delta`, `intermediate`, `tool_start`, `tool_end`, `done`, and `error`.
|
|
327
382
|
|
|
328
383
|
Pass `x-ms-session-id` header to continue a conversation across requests. If omitted, a new session is created automatically.
|
|
329
384
|
|
|
@@ -337,7 +392,7 @@ If there's no `main.agent.md`, the HTTP chat, MCP, and UI endpoints are all disa
|
|
|
337
392
|
|
|
338
393
|
## MCP Server Configuration
|
|
339
394
|
|
|
340
|
-
You can give your agent access to external MCP servers by creating an `mcp.json` file in the app root.
|
|
395
|
+
You can give your agent access to external MCP servers by creating an `mcp.json` file in the app root. Both **HTTP (Streamable)** remote servers and **stdio** servers are supported.
|
|
341
396
|
|
|
342
397
|
```json
|
|
343
398
|
{
|
|
@@ -345,6 +400,11 @@ You can give your agent access to external MCP servers by creating an `mcp.json`
|
|
|
345
400
|
"microsoft-learn": {
|
|
346
401
|
"type": "http",
|
|
347
402
|
"url": "https://learn.microsoft.com/api/mcp"
|
|
403
|
+
},
|
|
404
|
+
"filesystem": {
|
|
405
|
+
"type": "stdio",
|
|
406
|
+
"command": "npx",
|
|
407
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/data"]
|
|
348
408
|
}
|
|
349
409
|
}
|
|
350
410
|
}
|
|
@@ -352,14 +412,49 @@ You can give your agent access to external MCP servers by creating an `mcp.json`
|
|
|
352
412
|
|
|
353
413
|
Tools from configured MCP servers are automatically available to the agent at runtime. Each server entry supports:
|
|
354
414
|
|
|
355
|
-
- **`type`** — `"http"` (
|
|
356
|
-
- **`url`** — the MCP server endpoint URL
|
|
357
|
-
- **`
|
|
415
|
+
- **`type`** — `"http"` (Streamable HTTP transport) or `"stdio"`
|
|
416
|
+
- **`url`** — the MCP server endpoint URL (HTTP only)
|
|
417
|
+
- **`command`** + **`args`** + **`env`** — process spec (stdio only)
|
|
418
|
+
- **`headers`** — optional HTTP headers (e.g. for authentication; HTTP only)
|
|
358
419
|
- **`tools`** — optional array of tool name patterns to allow (default: `["*"]`)
|
|
359
420
|
|
|
421
|
+
> **Note**: SSE-transport MCP servers (`type: "sse"`) are no longer supported. Use the Streamable HTTP transport (`type: "http"`) instead.
|
|
422
|
+
|
|
423
|
+
## Session storage
|
|
424
|
+
|
|
425
|
+
Multi-turn conversations are persisted as JSONL files using MAF's `FileHistoryProvider`. Storage path resolution:
|
|
426
|
+
|
|
427
|
+
- When `CONTAINER_NAME` is set (Functions container) → `/code-assistant-session/agent-sessions/{session_id}.jsonl`
|
|
428
|
+
- Otherwise: `{AZURE_FUNCTIONS_AGENTS_CONFIG_DIR}/agent-sessions/{session_id}.jsonl`, defaulting to `~/.azure-functions-agents/agent-sessions/`
|
|
429
|
+
|
|
430
|
+
Session ids must match `^[A-Za-z0-9._-]{1,128}$` — anything else is rejected at the API boundary.
|
|
431
|
+
|
|
432
|
+
> **Single-process scope**: A per-session `asyncio.Lock` serializes concurrent turns within a single Function instance. The contract is "one active turn per session id". Multi-instance distributed locking is intentionally out of scope.
|
|
433
|
+
|
|
360
434
|
## Samples
|
|
361
435
|
|
|
362
|
-
See the [`samples/`](samples/) directory for complete, deployable example apps
|
|
436
|
+
See the [`samples/`](samples/) directory for complete, deployable example apps:
|
|
437
|
+
|
|
438
|
+
- [`basic-chat`](samples/basic-chat) — minimal chat agent with sandbox
|
|
439
|
+
- [`daily-azure-report`](samples/daily-azure-report) — timer-triggered agent that emails a daily Azure status report
|
|
440
|
+
- [`daily-tech-news-email`](samples/daily-tech-news-email) — timer-triggered agent that scrapes news and emails a digest
|
|
441
|
+
|
|
442
|
+
## Deployment Notes
|
|
443
|
+
|
|
444
|
+
### Required Azure App Settings
|
|
445
|
+
|
|
446
|
+
Set the model provider env vars described above (e.g. `OPENAI_API_KEY` and `MAF_MODEL`, or `AZURE_OPENAI_ENDPOINT` + `AZURE_OPENAI_DEPLOYMENT`).
|
|
447
|
+
|
|
448
|
+
When the agent uses connector tools or `execution_sandbox`, the function app's **system-assigned or user-assigned Managed Identity** must be enabled and granted access to the AI Gateway / Logic App connector resource — otherwise `DefaultAzureCredential` will fail to obtain an ARM token at startup.
|
|
449
|
+
|
|
450
|
+
### Optional config overrides
|
|
451
|
+
|
|
452
|
+
| Setting | Purpose |
|
|
453
|
+
|---|---|
|
|
454
|
+
| `AZURE_FUNCTIONS_AGENTS_APP_ROOT` | Override the app root used to discover `*.agent.md`, `tools/`, `skills/`, and `mcp.json` (legacy alias `COPILOT_APP_ROOT` still accepted with a deprecation warning) |
|
|
455
|
+
| `AZURE_FUNCTIONS_AGENTS_CONFIG_DIR` | Override the directory used for session storage (legacy alias `CODE_ASSISTANT_CONFIG_PATH` still accepted) |
|
|
456
|
+
| `AGENT_TIMEOUT` | Per-call timeout in seconds (default `900`) |
|
|
457
|
+
| `MAF_PROVIDER` | Pin the model provider (`openai`/`azure_openai`/`foundry`) and skip auto-detection |
|
|
363
458
|
|
|
364
459
|
## Development
|
|
365
460
|
|
|
@@ -374,7 +469,6 @@ pip install -e ".[connectors]"
|
|
|
374
469
|
# Build a wheel
|
|
375
470
|
pip install build
|
|
376
471
|
python -m build --wheel
|
|
377
|
-
# Output: dist/azure_functions_agents-0.7.1-py3-none-any.whl
|
|
378
472
|
```
|
|
379
473
|
|
|
380
474
|
## Contributing
|