Files
chetantoshniwal 52303a8d07 .NET: Add Code Interpreter container file download samples (#5014)
* Add Code Interpreter container file download samples (#3081)

- Add Agent_OpenAI_Step06_CodeInterpreterFileDownload (Public OpenAI)
- Add Agent_Step24_CodeInterpreterFileDownload (Microsoft Foundry)
- Both samples demonstrate downloading cfile_/cntr_ container files
  via ContainerClient instead of the standard Files API
- Update solution file and parent READMEs

* Address review feedback: flatten nested foreach loops using SelectMany

Addresses https://github.com/microsoft/agent-framework/pull/5014#discussion_r3046908449 and https://github.com/microsoft/agent-framework/pull/5014#discussion_r3046920209

---------

Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
Co-authored-by: rogerbarreto <rogerbarreto@users.noreply.github.com>
2026-04-17 16:55:03 +00:00

1.9 KiB

Agent Framework with OpenAI

These samples show how to use the Agent Framework with the OpenAI exchange types.

By default, the .Net version of Agent Framework uses the Microsoft.Extensions.AI.Abstractions exchange types.

For developers who are using the OpenAI SDK this can be problematic because there are conflicting exchange types which can cause confusion.

Agent Framework provides additional support to allow OpenAI developers to use the OpenAI exchange types.

Sample Description
Creating an AIAgent This sample demonstrates how to create and run a basic agent with native OpenAI SDK types. Shows both regular and streaming invocation of the agent.
Using Reasoning Capabilities This sample demonstrates how to create an AI agent with reasoning capabilities using OpenAI's reasoning models and response types.
Creating an Agent from a ChatClient This sample demonstrates how to create an AI agent directly from an OpenAI.Chat.ChatClient instance using OpenAIChatClientAgent.
Creating an Agent from an OpenAIResponseClient This sample demonstrates how to create an AI agent directly from an OpenAI.Responses.OpenAIResponseClient instance using OpenAIResponseClientAgent.
Managing Conversation State This sample demonstrates how to maintain conversation state across multiple turns using the AgentSession for context continuity.
Code Interpreter File Download This sample demonstrates how to download files generated by Code Interpreter using the Containers API (cfile_/cntr_ IDs).