mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Renamed async_credential to credential (#2648)
This commit is contained in:
committed by
GitHub
Unverified
parent
eb06faea2d
commit
cfcb71334a
@@ -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)
|
||||
|
||||
+8
-5
@@ -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.",
|
||||
|
||||
+7
-4
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user