Hi Team,
I encountered a problem when working with Azure AI Agents.
When an agent is created in Azure AI Foundry, it receives a unique agent_id (format: asst_...). However, this agent_id is not exposed anywhere on the BaseAgent (e.g. ChatAgent) API.
This makes it impossible to directly reference the created Foundry agent when using the AIProjectClient (azure.ai.projects.aio) unless the developer manually tracks the ID outside of the agent object.
Why this matters
Developers may need to interact with the same agent instance both through the agent_framework SDK (e.g. ChatAgent) and directly through the Foundry client (AIProjectClient). In general, since this is the agents primary key in the Azure AI Foundry, it is important that a developer know under which ID the agent got created. Without access to the agent_id, it is not possible to fetch, update, or manage the underlying Foundry agent.
It would be very helpful if the agent_id were exposed, for example via agent.metadata.agent_id or a similar property.
import asyncio
from agent_framework import ChatAgent
from agent_framework.azure import AzureAIAgentClient
from azure.ai.projects.aio import AIProjectClient
from azure.identity.aio import AzureCliCredential
PROJECT_ENDPOINT = "<YOUR-PROJECT-ENDPOINT"
async def main():
async with (
AzureCliCredential() as credential,
AIProjectClient(
endpoint=PROJECT_ENDPOINT ,
credential=credential
) as project_client,
):
agent1 = ChatAgent(
chat_client=AzureAIAgentClient(
project_client=project_client,
),
name="BugAgent3"
)
await agent1.run("Hello!")
# Currently this fails because `agent_id` is not exposed on BaseAgent
await project_client.agents.get_agent(agent_id=agent1.metadata.agent_id)
input("IDLE ")
if __name__ == '__main__':
asyncio.run(main())
Expected behavior
The BaseAgent (e.g. ChatAgent) should expose the Azure AI Foundry agent_id.
Example: agent1.metadata.agent_id returns asst_xxxxx.
Actual behavior
The agent_id exists internally but is not exposed, so the developer cannot use it to interact with the Foundry API.
Hi Team,
I encountered a problem when working with Azure AI Agents.
When an agent is created in Azure AI Foundry, it receives a unique
agent_id(format:asst_...). However, thisagent_idis not exposed anywhere on theBaseAgent(e.g.ChatAgent) API.This makes it impossible to directly reference the created Foundry agent when using the
AIProjectClient(azure.ai.projects.aio) unless the developer manually tracks the ID outside of the agent object.Why this matters
Developers may need to interact with the same agent instance both through the
agent_frameworkSDK (e.g.ChatAgent) and directly through the Foundry client (AIProjectClient). In general, since this is the agents primary key in the Azure AI Foundry, it is important that a developer know under which ID the agent got created. Without access to theagent_id, it is not possible to fetch, update, or manage the underlying Foundry agent.It would be very helpful if the
agent_idwere exposed, for example viaagent.metadata.agent_idor a similar property.Expected behavior
The
BaseAgent(e.g.ChatAgent) should expose the Azure AI Foundryagent_id.Example:
agent1.metadata.agent_idreturnsasst_xxxxx.Actual behavior
The
agent_idexists internally but is not exposed, so the developer cannot use it to interact with the Foundry API.