Skip to content

Python: AzureAIClient behavior -- Only first agent was created/registered in AI Foundry #2320

@chengyu-liu-cs

Description

@chengyu-liu-cs

Hi,

I am using this new agent client for Foundry Agent V2 APIs. But the behavior was a bit different as I expected.

When I create two agents with the same instance of AzureAIClient, only one agent (ie., the first agent) was created in Foundry and versioned. The second one can be used, but not registered in Foundry (e.g., Example 01).

# Example 1
    credential = AzureCliCredential()
    client =AzureAIClient(async_credential=credential,
                                project_endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
                                model_deployment_name=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"])

    writer = client.create_agent(
        instructions=("You are a concise copywriter. Provide a single, punchy marketing sentence based on the prompt."),
        name="writer",
    )

    reviewer = client.create_agent(
        instructions=("You are a thoughtful reviewer. Give brief feedback on the previous assistant message."),
        name="reviewer",
    )

In order to register both in Foundry, I needed to create two instances of AzureAIClient (e.g., Example 01). Is this expected behavior?

# Example 2
    writer = AzureAIClient(async_credential=credential,
                                project_endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
                                model_deployment_name=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"]).create_agent(
                                                                                                            instructions=("You are a concise copywriter. Provide a single, punchy marketing sentence based on the prompt."),
                                                                                                            name="writer",
                                                                                                        )

    reviewer = AzureAIClient(async_credential=credential,
                                project_endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
                                model_deployment_name=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"]).create_agent(
                                                                                                        instructions=("You are a thoughtful reviewer. Give brief feedback on the previous assistant message."),
                                                                                                        name="reviewer",

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpythonquestionFurther information is requestedv1.0Features being tracked for the version 1.0 GA

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions