mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
WIP: Refactor Workflow as agent pending request handling
This commit is contained in:
@@ -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",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user