-
Notifications
You must be signed in to change notification settings - Fork 942
.NET: Add Conversation State Sample (Step05) #2697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nagement Co-authored-by: rogerbarreto <[email protected]>
Co-authored-by: rogerbarreto <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new Getting Started sample (Step05) demonstrating conversation state management with OpenAI agents. The sample shows how to use the Agent Framework with OpenAI's Conversation API to maintain context across multiple agent invocations using server-side conversation storage.
Key changes:
- New sample demonstrating
ConversationClientintegration withOpenAIResponseClientAgent - Shows multi-turn conversations using
AgentThreadto maintain conversation history - Demonstrates conversation lifecycle including creation, retrieval, and deletion
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/samples/GettingStarted/AgentWithOpenAI/README.md | Adds reference to the new Step05 sample in the parent README |
| dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/README.md | Provides comprehensive documentation for the conversation state management sample |
| dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/Program.cs | Implements the sample code demonstrating server-side conversation management |
| dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/Agent_OpenAI_Step05_Conversation.csproj | Project configuration file matching other samples in the directory |
| dotnet/agent-framework-dotnet.slnx | Adds the new sample project to the solution file |
dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/Program.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/Program.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step05_Conversation/Program.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
* Initial plan * Add Agent_OpenAI_Step05_Conversation sample for conversation state management Co-authored-by: rogerbarreto <[email protected]> * Update Program.cs comment to accurately describe the sample Co-authored-by: rogerbarreto <[email protected]> * Update the code to use the ConversationClient more in line with the samples in OpenAI * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Changing sample to use ChatClientAgent and conversationId in GetNewThread --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: rogerbarreto <[email protected]> Co-authored-by: Copilot <[email protected]>
Motivation and Context
Adds a Getting Started sample demonstrating multi-turn conversation state management with OpenAI agents using the new Conversation API. Addresses the need for documentation on how to maintain conversation context across agent invocations with server-side storage.
Description
New sample Agent_OpenAI_Step05_Conversation showing:
ConversationClientintegration - Using OpenAI's Conversation API for server-side conversation storageOpenAIResponseClientAgentpattern - Using the Responses API with conversation stateAgentThreadusage - Creating and reusing threads to maintain conversation historyChatClientAgentRunOptions- Linking agent calls to server-side conversations via ConversationId