Files
microsoft--agent-framework/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering
Roger Barreto abe1f629a2 .NET: Add support for Resilient long-running and Steerable Foundry Hosted Agents (#7370)
* feat(foundry): add resilient background hosting

Enable AgentServer recovery and steering through FoundryResponsesOptions.

Persist AgentSession snapshots during long background turns while workflow checkpointing remains owned by the workflow runtime.

* feat(foundry): complete resilient and steerable hosting

* fix(foundry): address resilience review feedback

* feat(foundry): align resilient workflow checkpoints

* docs(foundry): update resilience review guidance
2026-08-22 03:55:32 +00:00
..

Hosted-Steering

A Foundry Hosted Agent with steerable conversations enabled. When a second input arrives while a conversation turn is running, AgentServer queues it instead of returning conversation_locked.

This sample deploys directly from source. Foundry uploads the project as a ZIP, restores its packages, builds it, and runs HostedSteering.dll. No Dockerfile or container registry is needed.

Key setting

builder.Services.AddFoundryResponses(
    agent,
    configure: options => options.SteerableConversations = true);

Steering and resilient background execution are separate options. This sample enables only steering. See Hosted-Workflow-Resilient for crash recovery.

Local development

Copy .env.example to .env, set the project endpoint and model deployment, then run:

az login
dotnet run --tl:off

The in-repository project automatically uses ProjectReference to run the current framework source.

Deploy from source

Create an empty working directory outside the repository:

$work = Join-Path $env:TEMP "hosted-steering-work"
New-Item -ItemType Directory -Path $work -Force | Out-Null
Set-Location $work

$sample = "<repo>/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering/azure.yaml"
azd auth login
azd ai agent init -m $sample -d <model-deployment>

Contributors testing framework changes

Skip this section unless you are testing an Agent Framework change from the current codebase that has not been released yet. The normal deployment uses the published packages. To test local framework changes, pack the current repository source into the scaffolded upload before provisioning:

<repo>/dotnet/samples/04-hosting/FoundryHostedAgents/scripts/Add-LocalFrameworkFeed.ps1 `
    -Path ./hosted-steering

The helper creates local-feed/, writes nuget.config, and changes AgentFrameworkVersion in the scaffolded project. Both generated artifacts are included in the source ZIP.

Set-Location hosted-steering
azd env set AZURE_AI_MODEL_DEPLOYMENT_NAME <model-deployment>
azd provision
azd deploy

Exercise steering

Start a stored background response, keep its response or conversation identity, then submit a second input to the same in-progress conversation. The second request should be queued instead of rejected. Use the Responses API or an OpenAI-compatible client that exposes background and conversation fields.