mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
* Rename AgentThread to AgentSession * Add more renames * Update readme files * Revert nullable variable change and further fixes. * Revert change in header name * Fix some comments and tests * Update changelog. * Address PR feedback. * Fixing code review comments. * Fix new errors after merging latest code.
Creating an Agent from an OpenAIResponseClient
This sample demonstrates how to create an AI agent directly from an OpenAI.Responses.OpenAIResponseClient instance using the OpenAIResponseClientAgent class.
What This Sample Shows
- Direct OpenAIResponseClient Creation: Shows how to create an
OpenAI.Responses.OpenAIResponseClientfromOpenAI.OpenAIClientand then use it to instantiate an agent - OpenAIResponseClientAgent: Demonstrates using the OpenAI SDK primitives instead of the ones from Microsoft.Extensions.AI and Microsoft.Agents.AI abstractions
- Full Agent Capabilities: Shows both regular and streaming invocation of the agent
Running the Sample
-
Set the required environment variables:
set OPENAI_API_KEY=your_api_key_here set OPENAI_MODEL=gpt-4o-mini -
Run the sample:
dotnet run