Skip to content

Conversation

@elbruno
Copy link
Collaborator

@elbruno elbruno commented May 30, 2025

DETAILS

  • Updated AgentLabs-01-Simple.csproj to replace the package reference for Azure.AI.Projects with Azure.AI.Agents.Persistent and updated versions of Azure.AI.Projects and Microsoft.Extensions.Configuration.UserSecrets.
  • Refactored Program.cs to use PersistentAgentsClient instead of AgentsClient, including new user secrets for tenant ID and endpoint retrieval.
  • Changed agent model from "gpt-4o-mini" to "gpt-4.1" and updated message handling to use asynchronous methods.
  • Added agent deletion after use to clean up resources.

DETAILS

- Updated `AgentLabs-01-Simple.csproj` to replace the package reference for `Azure.AI.Projects` with `Azure.AI.Agents.Persistent` and updated versions of `Azure.AI.Projects` and `Microsoft.Extensions.Configuration.UserSecrets`.
- Refactored `Program.cs` to use `PersistentAgentsClient` instead of `AgentsClient`, including new user secrets for tenant ID and endpoint retrieval.
- Changed agent model from `"gpt-4o-mini"` to `"gpt-4.1"` and updated message handling to use asynchronous methods.
- Added agent deletion after use to clean up resources.
@elbruno elbruno requested a review from Copilot May 30, 2025 13:37
@github-actions
Copy link

👋 Thanks for contributing @elbruno! We will review the pull request and get back to you soon.

Copy link
Contributor

Copilot AI left a 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 updates Azure SDK dependencies and refactors the sample to use the new persistent agents API, modernizes the agent model, and ensures cleanup of created agents.

  • Swapped out Azure.AI.Projects for Azure.AI.Agents.Persistent and bumped package versions.
  • Refactored Program.cs to use PersistentAgentsClient, async message handling, and new user secrets.
  • Changed model from gpt-4o-mini to gpt-4.1 and added agent deletion after use.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
03-CoreGenerativeAITechniques/src/AgentLabs-01-Simple/Program.cs Refactored to use PersistentAgentsClient, updated async flows, and added cleanup.
03-CoreGenerativeAITechniques/src/AgentLabs-01-Simple/AgentLabs-01-Simple.csproj Updated package references and versions.
Comments suppressed due to low confidence (3)

03-CoreGenerativeAITechniques/src/AgentLabs-01-Simple/Program.cs:14

  • [nitpick] The variable name tenantid is all lowercase and a bit ambiguous. Consider renaming to tenantId for consistency with C# naming conventions.
var tenantid = config["aifoundryproject_tenantid"];

03-CoreGenerativeAITechniques/src/AgentLabs-01-Simple/Program.cs:15

  • [nitpick] The variable aifoundryproject_endpoint lacks camelCase formatting and is verbose. Consider renaming to projectEndpoint or agentEndpoint for clarity.
var aifoundryproject_endpoint = config["aifoundryproject_endpoint"];

03-CoreGenerativeAITechniques/src/AgentLabs-01-Simple/Program.cs:81

  • The new agent deletion step should be covered by tests to ensure resources are cleaned up correctly in all scenarios (e.g., failures during run).
await persistentClient.Administration.DeleteAgentAsync(agentMathTutor.Id);

@elbruno elbruno merged commit 22b2786 into main May 30, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants