This sample demonstrates how to create an AI agent directly from an OpenAI.Chat.ChatClient instance using the OpenAIChatClientAgent class.
- Direct ChatClient Creation: Shows how to create an
OpenAI.Chat.ChatClientfromOpenAI.OpenAIClientand then use it to instantiate an agent - OpenAIChatClientAgent: 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
-
Set the required environment variables:
set OPENAI_API_KEY=your_api_key_here set OPENAI_CHAT_MODEL_NAME=gpt-5.4-mini
-
Run the sample:
dotnet run