Refresh agent-background-responses skill reference for current Agent Framework API#25
Conversation
…s, tools+persistence section Co-authored-by: KSemenenko <4385716+KSemenenko@users.noreply.github.com>
|
@copilot resolve conflict |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3247cc44fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| lastReceivedUpdate = update; | ||
|
|
||
| // Simulate connection loss after first piece of content received | ||
| if (update.Text.Length > 0) |
There was a problem hiding this comment.
Guard stream update text before checking length
This new interruption condition dereferences update.Text directly, but streaming updates are not guaranteed to carry text content (for example, tool-call or metadata updates), so update.Text can be null. In that case this sample throws NullReferenceException before storing a continuation token, which breaks the resume flow it is trying to demonstrate.
Useful? React with 👍 / 👎.
| while (response.ContinuationToken is not null) | ||
| { | ||
| // Persist session and continuation token to durable storage | ||
| await PersistAgentState(agent, session, response.ContinuationToken); |
There was a problem hiding this comment.
Persist the restored session state inside polling loop
Inside the new tools/persistence example, each iteration persists session even after the run is resumed with restoredSession. On the second and later iterations this can save an outdated session snapshot paired with a newer continuation token, causing state drift when restoring after interruptions. The persisted session should be the same session instance used for the latest RunAsync call.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Updates the .NET Microsoft Agent Framework skill package metadata and refreshes the “Agent Background Responses” reference doc to reflect newer samples and guidance around continuation tokens, streaming resumption, and tool/state persistence.
Changes:
- Bump skill version from
1.4.0to1.4.1. - Update background responses doc metadata date and sample link, and revise C# examples (client setup, polling, streaming resumption).
- Add a new section describing background responses with function tools and session/state persistence, plus updated best practices/limitations notes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| skills/dotnet-microsoft-agent-framework/SKILL.md | Version bump for the skill package. |
| skills/dotnet-microsoft-agent-framework/references/official-docs/user-guide/agents/agent-background-responses.md | Refreshes background responses documentation, examples, and adds tools/persistence guidance. |
You can also share your feedback on Copilot code review. Take the survey.
| new Uri(endpoint), | ||
| new DefaultAzureCredential()) | ||
| .GetResponsesClient(deploymentName) |
| AgentSession session = await agent.CreateSessionAsync(); | ||
|
|
||
| // Get initial response - may return with or without a continuation token | ||
| AgentResponse response = await agent.RunAsync("Write a very long novel about otters in space.", thread, options); | ||
| AgentResponse response = await agent.RunAsync("Write a very long novel about otters in space.", session, options); | ||
|
|
||
| // Continue to poll until the final response is received | ||
| while (response.ContinuationToken is not null) | ||
| while (response.ContinuationToken is { } token) |
| options.ContinuationToken = continuationToken; | ||
| response = await agent.RunAsync(restoredSession, options); |
|
|
||
| - Background responses are dependent on the underlying AI service supporting long-running operations | ||
| - Not all agent types may support background responses | ||
| - Currently only agents using the OpenAI Responses API (`GetResponsesClient`) support background responses |
…p SKILL.md to 1.5.1 Co-authored-by: KSemenenko <4385716+KSemenenko@users.noreply.github.com>
|
@copilot resolve conflicts |
|
@codex resolve conflicts |
|
Summary
Testing
|
Upstream documentation for
agent-background-responseschanged (ETag mismatch detected by watch). The existing reference snapshot used stale sample paths and a renamed API surface.Reference file updates (
agent-background-responses.md)GettingStarted/Agents/Agent_Step17_BackgroundResponses→dotnet/samples/02-agents/Agents/Agent_Step14_BackgroundResponsesAgentThread/GetNewThreadAsync()→AgentSession/CreateSessionAsync()GetOpenAIResponseClient()→GetResponsesClient()AzureCliCredential→DefaultAzureCredential(with production caution note)Agent_Step10_BackgroundResponsesWithToolsAndPersistencesample: function tools during background ops,SerializeSessionAsync/DeserializeSessionAsync, andAgentAbstractionsJsonUtilities.DefaultOptionsforResponseContinuationTokenround-trippingGetResponsesClient-based agents onlySKILL.md
Incorporated
AgentWorkflowBuilderadditions from main (BuildConcurrentfactory method in Core Knowledge and Decision Cheatsheet). Version bumped1.4.0→1.5.1to reflect both the merged main changes and the material reference update.Original prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.