Renamed async_credential to credential (#2648)

This commit is contained in:
Dmytro Struk
2025-12-07 17:21:18 -08:00
committed by GitHub
Unverified
parent eb06faea2d
commit cfcb71334a
64 changed files with 266 additions and 269 deletions
@@ -30,10 +30,13 @@ async def run_agent_framework() -> None:
from agent_framework.azure import AzureAIAgentClient
from azure.identity.aio import AzureCliCredential
async with AzureCliCredential() as credential, AzureAIAgentClient(async_credential=credential).create_agent(
name="Support",
instructions="Answer customer questions in one paragraph.",
) as agent:
async with (
AzureCliCredential() as credential,
AzureAIAgentClient(credential=credential).create_agent(
name="Support",
instructions="Answer customer questions in one paragraph.",
) as agent,
):
# AF client returns an asynchronous context manager for remote agents.
reply = await agent.run("How do I upgrade my plan?")
print("[AF]", reply.text)
@@ -33,11 +33,14 @@ async def run_agent_framework() -> None:
from agent_framework.azure import AzureAIAgentClient, HostedCodeInterpreterTool
from azure.identity.aio import AzureCliCredential
async with AzureCliCredential() as credential, AzureAIAgentClient(async_credential=credential).create_agent(
name="Analyst",
instructions="Use the code interpreter for numeric work.",
tools=[HostedCodeInterpreterTool()],
) as agent:
async with (
AzureCliCredential() as credential,
AzureAIAgentClient(credential=credential).create_agent(
name="Analyst",
instructions="Use the code interpreter for numeric work.",
tools=[HostedCodeInterpreterTool()],
) as agent,
):
# HostedCodeInterpreterTool mirrors the built-in Azure AI capability.
reply = await agent.run(
"Use Python to compute 42 ** 2 and explain the result.",
@@ -36,10 +36,13 @@ async def run_agent_framework() -> None:
from agent_framework.azure import AzureAIAgentClient
from azure.identity.aio import AzureCliCredential
async with AzureCliCredential() as credential, AzureAIAgentClient(async_credential=credential).create_agent(
name="Planner",
instructions="Track follow-up questions within the same thread.",
) as agent:
async with (
AzureCliCredential() as credential,
AzureAIAgentClient(credential=credential).create_agent(
name="Planner",
instructions="Track follow-up questions within the same thread.",
) as agent,
):
thread = agent.get_new_thread()
# AF threads are explicit and can be serialized for external storage.
first = await agent.run("Outline the onboarding checklist.", thread=thread)