Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d90355f
Python: exclude encrypted reasoning payloads from compaction token co…
Lubaoshuai Sep 17, 2026
f187b68
Python: preserve approval context across resume paths (#8433)
eavanvalkenburg Sep 17, 2026
3b110ad
Python: include checkpoint_id on AG-UI interrupt metadata (#8150) (#8…
FOWEPJF255 Sep 17, 2026
52e03cb
.NET/Python: Refine skill frontmatter parsing (#8430)
SergeyMenshykh Sep 17, 2026
a3fc29d
.NET/Python: Add more content types to purview handling (#8370)
westey-m Sep 17, 2026
0c07eb6
Python: Add per-tool AgentModeProvider exposure controls (#8450)
eavanvalkenburg Sep 17, 2026
63aacbb
Python: expose instrumentation message event control (#8451)
eavanvalkenburg Sep 17, 2026
0275ebf
.NET: [BREAKING] Scope provider-backed MCP sessions per invocation (#…
jpalvarezl Sep 17, 2026
dcd2c4d
Allow disabling function tools on ModeProvider (#8458)
westey-m Sep 17, 2026
81c47e2
Clarify Agent Skills caching behavior (#8474)
SergeyMenshykh Sep 17, 2026
6817fbd
docs: clarifies the additional languages policy (#8477)
baywet Sep 17, 2026
3c83441
ci: excludes samples from dotnet dependabot because they are causing …
baywet Sep 17, 2026
d188e8e
.NET: Make Foundry user identity session sticky (#8434)
rogerbarreto Sep 17, 2026
8559a7b
Build(deps): Bump azure/login (#8485)
dependabot[bot] Sep 17, 2026
5e0f3a5
Build(deps): Bump astral-sh/setup-uv from 10.0.1 to 10.1.0 (#8482)
dependabot[bot] Sep 17, 2026
200b787
Build(deps): Bump astral-sh/setup-uv in /.github/actions/python-setup…
dependabot[bot] Sep 17, 2026
3b45c56
Build(deps): Bump azure/login in /.github/actions/github-app-token (#…
dependabot[bot] Sep 17, 2026
bc57ce8
Build(deps): Bump azure/login from 3.0.2 to 3.1.0 (#8481)
dependabot[bot] Sep 17, 2026
459fe6e
Build(deps): Bump the codeql-actions group across 1 directory with 3 …
dependabot[bot] Sep 17, 2026
7a5acf1
Build(deps-dev): Bump agent-framework-openai in /python/packages/lab …
dependabot[bot] Sep 17, 2026
12603b6
Build(deps): Bump huggingface-hub in /python/packages/lab (#8472)
dependabot[bot] Sep 17, 2026
06f7909
Build(deps): Bump agent-framework-core in /python/packages/lab (#8471)
dependabot[bot] Sep 17, 2026
5494410
Build(deps-dev): Bump pyright (#8470)
dependabot[bot] Sep 17, 2026
fa359ab
Build(deps-dev): Bump uv (#8469)
dependabot[bot] Sep 17, 2026
a08534c
Python: fix Cosmos memory retrieval compatibility (#8460)
eavanvalkenburg Sep 18, 2026
2e06531
ci: update Python dependencies across projects
eavanvalkenburg Sep 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/github-app-token/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ runs:
id: azure-login
if: ${{ (inputs.mode || 'app-with-fallback') != 'pat' }}
continue-on-error: true
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ inputs.azure-client-id }}
tenant-id: ${{ inputs.azure-tenant-id }}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/python-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
using: "composite"
steps:
- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version-file: "python/pyproject.toml"
enable-cache: true
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/sample-validation-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ runs:
sample-playbooks-${{ github.job }}-

- name: Azure CLI Login
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ inputs.azure-client-id }}
tenant-id: ${{ inputs.azure-tenant-id }}
Expand Down
10 changes: 9 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ updates:
# Maintain dependencies for nuget
- package-ecosystem: "nuget"
directory: "dotnet/"
# The samples tree contains most of the .NET package manifests and causes
# the NuGet updater to exceed Dependabot's fixed execution timeout. Keep the
# production source, tests, and central package versions in scope so updates
# can be opened again.
exclude-paths:
- "samples/**"
schedule:
interval: "cron"
cronjob: "0 8 * * 4,0" # Every Thursday(4) and Sunday(0) at 8:00 UTC
Expand Down Expand Up @@ -55,7 +61,9 @@ updates:
# TODO: Remove these Python Dependabot entries after we have confidence in the
# Python dependency-maintenance workflow.
- package-ecosystem: "pip"
directory: "python/"
directories:
- "python/"
- "python/packages/lab/"
schedule:
interval: "weekly"
day: "thursday"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
uses: github/codeql-action/init@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -51,7 +51,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
uses: github/codeql-action/autobuild@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -64,6 +64,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
uses: github/codeql-action/analyze@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/devflow-pr-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:
python-version: "3.13"

- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version: "0.11.x"
enable-cache: auto
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dotnet-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ jobs:

- name: Azure CLI Login
if: github.event_name != 'pull_request' && matrix.integration-tests
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down Expand Up @@ -562,7 +562,7 @@ jobs:
run: dotnet build dotnet/tests/Foundry.Hosting.IntegrationTests/Foundry.Hosting.IntegrationTests.csproj -c "$configuration" --warnaserror

- name: Azure CLI Login
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
done

- name: Azure CLI Login
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-verify-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:

- name: Azure CLI Login
if: github.event_name != 'pull_request'
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-automation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
with:
python-version: "3.11"

- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version: "0.12.9"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
python-version: "3.13"

- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version: "0.11.x"
enable-cache: true
Expand All @@ -200,7 +200,7 @@ jobs:
run: uv sync --frozen

- name: Azure CLI Login
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-api-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
persist-credentials: false

- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
enable-cache: false
version: "0.12.9"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version-file: "python/pyproject.toml"
enable-cache: auto
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ jobs:
python-version: ${{ env.UV_PYTHON }}
os: ${{ runner.os }}
- name: Azure CLI Login
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down Expand Up @@ -403,7 +403,7 @@ jobs:
python-version: ${{ env.UV_PYTHON }}
os: ${{ runner.os }}
- name: Azure CLI Login
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down Expand Up @@ -453,7 +453,7 @@ jobs:
python-version: ${{ env.UV_PYTHON }}
os: ${{ runner.os }}
- name: Azure CLI Login
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-lab-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version-file: "python/packages/lab/pyproject.toml"
python-version: ${{ matrix.python-version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-merge-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ jobs:
os: ${{ runner.os }}
- name: Azure CLI Login
if: github.event_name != 'pull_request'
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down Expand Up @@ -546,7 +546,7 @@ jobs:
os: ${{ runner.os }}
- name: Azure CLI Login
if: github.event_name != 'pull_request'
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down Expand Up @@ -607,7 +607,7 @@ jobs:
os: ${{ runner.os }}
- name: Azure CLI Login
if: github.event_name != 'pull_request'
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ You can contribute to Agent Framework with issues and pull requests (PRs). Simpl
filing issues for problems you encounter is a great way to contribute. Contributing
code is greatly appreciated.

This repository is dedicated to the canonical .NET and Python implementations of
Microsoft Agent Framework. Microsoft contributors outside the product team should
engage with the maintainers before submitting pull requests that add new language
implementations or before starting a new Microsoft-owned repository for another
language.

Contributors outside Microsoft are welcome to start their own repositories to
implement Microsoft Agent Framework in other languages, as long as they make it
clear that the effort is not owned or maintained directly by Microsoft.

## Reporting Issues

We always welcome bug reports, API proposals and overall feedback. Here are a few
Expand Down
13 changes: 8 additions & 5 deletions docs/specs/004-python-function-calling-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,12 @@ Before acting on a model function-call batch, the loop classifies every actionab
call aborts the complete batch before approval state changes or execution. Otherwise approval-required and Host-owned
calls are returned together in model order, while session-backed executable siblings remain deferred. An incomplete
session-backed mixed approval/Host response remains pending without executing a deferred call; a stateless incomplete
response is rejected. Correlation is scoped to the active mixed batch so completed or abandoned historical Host calls
remain unchanged. `ToolApprovalMiddleware` may resolve approval requests through standing or automatic policies, but
it preserves non-approval user-input requests and does not split manual approvals away from their Host-owned siblings.
response is rejected, including when no response is supplied, message roles vary within the model output, or a newer
standalone request follows the incomplete batch. Stateless discovery selects the latest unresolved mixed batch, so a
completed batch remains inert on later turns. Correlation is scoped to the active mixed batch so completed or abandoned
historical Host calls remain unchanged.
`ToolApprovalMiddleware` may resolve approval requests through standing or automatic policies, but it preserves
non-approval user-input requests and does not split or reorder manual approvals relative to their Host-owned siblings.

### Reasoning-bound function-call groups

Expand Down Expand Up @@ -612,15 +615,15 @@ that manually replay messages own the equivalent rule: do not resend an approval
| Scenario | Required invariant | Primary regression test |
|---|---|---|
| Fatal call mixed with pauses | Complete-batch classification raises before approval or execution, independent of call order. | `packages/core/tests/core/test_function_invocation_logic.py::test_mixed_batch_fatal_unknown_precedes_every_pause` |
| Approval and Host-owned calls | Both pause types are returned in model order; a session-backed partial response remains pending across serialization; historical Host calls do not participate; a complete response executes the exact approved arguments once. | `test_mixed_batch_returns_approval_and_host_pause_in_model_order`, `test_mixed_batch_requires_complete_responses_before_execution`, `test_active_mixed_pause_ignores_historical_host_requests` |
| Approval and Host-owned calls | Both pause types are returned in model order; a session-backed partial response remains pending across serialization; a stateless zero-response or partial response fails closed across message roles and cannot be hidden by a newer standalone request; completed mixed batches remain inert; historical Host calls do not participate; a complete response executes the exact approved arguments once. | `test_mixed_batch_returns_approval_and_host_pause_in_model_order`, `test_mixed_batch_requires_complete_responses_before_execution`, `test_stateless_split_mixed_batch_rejects_incomplete_replay_before_execution`, `test_stateless_mixed_batch_across_message_roles_requires_complete_responses`, `test_later_standalone_request_does_not_hide_incomplete_stateless_mixed_batch`, `test_completed_split_stateless_mixed_batch_is_inert_on_later_turn`, `test_active_mixed_pause_ignores_historical_host_requests` |
| Safe and approval-required calls in one batch | Hidden safe calls replay only with the matching visible approval. | `packages/core/tests/core/test_harness_tool_approval.py::test_mixed_batch_hides_already_approved_request_until_approval_replay` |
| Restored approval state | Serialized `ToolApprovalState` restores mixed-batch behavior. | `test_mixed_batch_accepts_restored_tool_approval_state` |
| Unrelated turn before approval | Hidden calls do not execute on an unrelated turn. | `test_hidden_mixed_batch_requests_do_not_replay_on_unrelated_turn` |
| Multiple abandoned batches | Hidden calls replay only for the matching batch. | `test_hidden_mixed_batch_requests_replay_only_for_matching_visible_approval` |
| Queued approvals | One unresolved approval is surfaced per run without premature execution. | `test_tool_approval_middleware_queues_multiple_approval_requests`, `test_tool_approval_middleware_queues_streamed_approval_requests` |
| Middleware state plus hidden core state | State saves do not discard hidden mixed-batch calls. | `test_tool_approval_middleware_preserves_hidden_mixed_batch_requests` |
| Auto-approval callback | Callback receives the original function call and executes the approved set once. | `test_tool_approval_middleware_auto_approval_rule_receives_function_call` |
| Approval policy with Host-owned sibling | Reordering the same calls has the same outcome; auto-approved and safe calls remain deferred until Host input arrives; manual approvals stay in the mixed batch; an approved Host tool returns to Host-owned handling before local execution. | `test_tool_approval_middleware_mixed_batch_is_order_independent`, `test_tool_approval_middleware_auto_approves_with_host_pause_and_cached_safe_call`, `test_tool_approval_middleware_keeps_manual_approvals_together_with_host_pause`, `test_tool_approval_middleware_policy_approval_reclassifies_host_tool` |
| Approval policy with Host-owned sibling | Reordering the same calls has the same outcome; auto-approved and safe calls remain deferred until Host input arrives; separately streamed Host input stays immediately visible while later manual approvals remain in model order and in the same batch; an approved Host tool returns to Host-owned handling before local execution. | `test_tool_approval_middleware_mixed_batch_is_order_independent`, `test_tool_approval_middleware_auto_approves_with_host_pause_and_cached_safe_call`, `test_tool_approval_middleware_keeps_manual_approvals_together_with_host_pause`, `test_tool_approval_middleware_preserves_split_streamed_mixed_batch_order`, `test_tool_approval_middleware_streams_standalone_user_input_immediately`, `test_tool_approval_middleware_policy_approval_reclassifies_host_tool` |
| Shared call budget | Auto-approved re-entry does not reset `max_function_calls`, and every executed approval group counts even when it pauses for input. | `test_tool_approval_middleware_auto_approved_loops_share_function_call_budget`, `test_approval_resume_user_input_counts_toward_function_call_budget` |
| Standing tool rule | Tool-level approval applies only to later matching tools. | `test_tool_approval_middleware_always_approve_tool_rule` |
| Forged standing rule | An unbound or substituted hosted response cannot create a standing middleware approval rule for caller-selected metadata. | `test_tool_approval_middleware_drops_forged_standing_approval`, `test_tool_approval_middleware_rebinds_hosted_standing_approval` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using DotNetEnv;
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.Foundry;
using Microsoft.Extensions.AI;

Env.TraversePath().Load();

Expand Down Expand Up @@ -96,22 +95,19 @@ User Isolation Agent Sample
if (!userSessions.TryGetValue(userId, out ChatClientAgentSession? userSession))
{
userSession = await agent.CreateFoundryHostedAgentSessionAsync(
hostedSessionId: hostedSessionId);
hostedSessionId: hostedSessionId,
userIdentity: userId);
userSessions.Add(userId, userSession);
Console.WriteLine($"Created an independent conversation for '{userId}'.");
}

var runOptions = new ChatClientAgentRunOptions(
new ChatOptions().WithFoundryHostedAgentUserIdentity(userId));

Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write($"Agent for {userId}> ");
Console.ResetColor();

await foreach (AgentResponseUpdate update in agent.RunStreamingAsync(
input,
userSession,
runOptions))
userSession))
{
Console.Write(update);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ This client demonstrates delegated user identity for a middle tier that serves s
users through one Foundry hosted session.

The sample creates one shared hosted session. Each user receives a separate Agent Framework
`AgentSession`, and every invocation sends that user's stable identifier through
`ChatOptions.WithFoundryHostedAgentUserIdentity`. Agent Framework places the value in the
`x-ms-user-identity` request header.
`AgentSession` created with that user's stable identifier. Agent Framework stores the identifier
with the session and automatically places it in the `x-ms-user-identity` request header on every
invocation that reuses the session.

## What Foundry isolates

Expand All @@ -25,6 +25,10 @@ The sample deliberately creates one `AgentSession` per user. Reusing one `AgentS
users would also reuse its conversation continuation identifier. Foundry rejects that cross user
continuation rather than exposing the first user's history.

The delegated identity is fixed when `CreateFoundryHostedAgentSessionAsync` creates the local
`AgentSession`. To serve another user, create another `AgentSession`; it may still reference the same
hosted sandbox.

## What the application must isolate

Foundry isolates the conversation history it manages. It does not automatically partition arbitrary
Expand Down
Loading
Loading