Skip to content

.NET: Sample for creating and deleting Conversations for V2 implementation of agents #2907

Description

@Ragini-Microsoft

For foundry agents V2, there's a sample code for creating conversations using the OpenAI client obtained from the AIProjectClient in Python.
https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/agents/azure_ai/azure_ai_with_existing_conversation.py

What I’ve tried (in .NET) for V2
I am able to successfully retrieve an existing Azure AI Foundry agent by name using the Azure AI Projects client, as shown in the sample:
https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/Program.cs

// Use Azure AI Projects client (Foundry v2 approach)
AIProjectClient projectClient = new AIProjectClient(new Uri(endpoint), credential);
// Get the existing Azure AI Foundry agent by name with latest version
_agent = projectClient.GetAIAgent(name: _chatAgentName);

However, I am unable to find an equivalent .NET code sample for V2 implementation that demonstrates:

  1. Creating a conversation
  2. Retrieving the conversation ID
  3. Deleting a conversation

How can this be done in .Net? Please provide sample code

Metadata

Metadata

Assignees

Labels

.NETUsage: [Issues, PRs], Target: .NetagentsUsage: [Issues, PRs], Target: Single agent

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions