Skip to content

Integration for Azure.AI.projects #7819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

aaronpowell
Copy link
Contributor

@aaronpowell aaronpowell commented Feb 28, 2025

Description

A client integration for working with the Azure.AI.Projects SDK, which allows you to create agents using Agent Service.

Currently, the integration added AIProjectClient to the service collection, and from that you can create an AgentClient (see the sample app), but I wonder if we should have a way to register the AgentClient as part of the initial registration (and similarly expand out to the other available clients, I just haven't used them yet).

Fixes #7768

Related to #7868 for hosting

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

This allows you to integrate with Azure AI Agent Service, and other services available via the SDK.

Fixes dotnet#7768
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Feb 28, 2025
@aaronpowell
Copy link
Contributor Author

Note - there is a new NuGet package required for this that isn't in the proxy package feed, Azure.AI.Projects 1.0.0-beta.3, so that needs to be pulled in for CI.


if (string.IsNullOrEmpty(connectionString) && settings.Endpoint is not null)
{
connectionString = $"{settings.Endpoint.Host};{settings.SubscriptionId};{settings.ResourceGroupName};{settings.ProjectName}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't really make sense to piece this connection string apart in Parse, just to connect it back together here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just coming back to this, and I think there might be a misunderstanding in the connection string, or maybe my design isn't as ideal as it could be.

In AI Foundry when you access a Project, the "connection string" is in the above format, endpoint;sub id;rg name;project name. This formatted value needs to be provided to the AIProjectClient when created.

The approach I was targeting in the settings object design was that you could provide the "connection string" in the format like you've copy/pasted from the web UI, or if you'd prefer you can provide each of the four parts as settings properties and we'll format it correctly for you. This is because there doesn't seem to be a way in Bicep to get the formatted value, you must do that yourself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be something that AzureAIProjectSettings should be responsible for at the ParseConnectionString-time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so, if you think it makes more sense to be able to go settings.ConnectionString and have it essentially non-nullable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep a simple ConnectionString {get; set;} and just do validation in the ParseConnectionString to set it to ConnectionString. If it's set the client will use it. If it's not set if will create one from the other properties from the settings after validating they are correct (all required, and format is fine).

This way when the host sets the connection string, the ParseConnectionString is invoked and can assign the ConnectionString setting. When it's not set the custom properties are used.

@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 10, 2025
@danmoseley
Copy link
Member

@aaronpowell do you plan to address feedback above?

@danmoseley danmoseley added the needs-author-action An issue or pull request that requires more info or actions from the author. label May 1, 2025
@aaronpowell
Copy link
Contributor Author

@aaronpowell do you plan to address feedback above?

Yep, I was talking with @sebastienros and will look to pick this up again, so I'll address the feedback, update the branch, and tackle the other gaps.

@dotnet-policy-service dotnet-policy-service bot removed the needs-author-action An issue or pull request that requires more info or actions from the author. label May 2, 2025
@aaronpowell aaronpowell marked this pull request as ready for review May 5, 2025 03:20
@aaronpowell
Copy link
Contributor Author

@sebastienros this should be good to review with the AI work

@sebastienros
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@aaronpowell
Copy link
Contributor Author

We need to add the NuGet package Azure.AI.Projects version 1.0.0-beta.8 to the package feed.

@sebastienros
Copy link
Member

We need to add the NuGet package Azure.AI.Projects version 1.0.0-beta.8 to the package feed.

I did that yesterday, that's why I triggered the build manually

@sebastienros
Copy link
Member

Co-authored-by: Sébastien Ros <sebastienros@gmail.com>
<Description>A client for Azure AI Agent Service that integrates with Aspire, including logging and telemetry.</Description>
<PackageIconFullPath>$(SharedDir)Azure_256x.png</PackageIconFullPath>
<NoWarn>$(NoWarn);SYSLIB1100;SYSLIB1101</NoWarn>
<!-- In preview until the public API is validated and the Microsoft.Extensions.AI integration is designed.. -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<!-- In preview until the public API is validated and the Microsoft.Extensions.AI integration is designed.. -->
<!-- In preview until the public API is validated and the package is stable. -->

If you are motivated could you please also update the Aspire.Azure.AI.OpenAI and Aspire.OpenAI project where this string is coming from?

@sebastienros
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client integration for Azure.AI.Projects
5 participants