WIP: Refactor Workflow as agent pending request handling

This commit is contained in:
Tao Chen
2026-05-28 17:20:52 -07:00
Unverified
parent 8ed2159c4b
commit 4428d53a1e
3 changed files with 87 additions and 133 deletions
@@ -1,8 +1,9 @@
# Copyright (c) Microsoft. All rights reserved.
import os
from random import randint
from agent_framework import Agent, AgentExecutor, WorkflowBuilder
from agent_framework import Agent, AgentExecutor, WorkflowBuilder, tool
from agent_framework.foundry import FoundryChatClient
from agent_framework_foundry_hosting import ResponsesHostServer
from azure.identity import DefaultAzureCredential
@@ -12,6 +13,13 @@ from dotenv import load_dotenv
load_dotenv()
@tool(approval_mode="always_require")
def get_locale() -> str:
"""Get the weather for a given location."""
conditions = ["CZ", "US", "FR", "DE"]
return f"The locale is {conditions[randint(0, 3)]}."
def main():
client = FoundryChatClient(
project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
@@ -22,6 +30,7 @@ def main():
writer_agent = Agent(
client=client,
instructions=("You are an excellent slogan writer. You create new slogans based on the given topic."),
tools=[get_locale],
name="writer",
)