![]() |
| https://www.pexels.com/photo/brown-sander-1571736/ |
Providing tools to an AI agent unlocks enhanced capabilities, allowing it to call external functions and APIs for tasks that exceed its native reasoning.
In the Microsoft Agent Framework (MAF), both functions and agents can be exposed as tools. This means an agent can invoke a standalone function or even another agent to accomplish a specialized task.
Here's a simple example that shows how to register both a function tool and an agent-as-tool in MAF:
agent = chat_client.create_agent(
instructions=(
"You are a travel assistant. Use the 'favorite_place' tool to figure out the "
"user's favorite place to visit. And, the 'tourist_guide_agent' to get 3 "
"place of interests for that location. IMPORTANT: do not provide any more "
"information."
),
tools=[get_place, tourist_guide_agent],
)
In this setup, get_place is a function tool that retrieves the user's favorite destination, and tourist_guide_agent is another agent that returns a curated list of points of interest for that location.
Demo
Check out the complete implementation: https://github.com/dennisseah/maf-workflow/blob/main/samples/tools.py
Video Walkthrough (view in fullscreen, no audio)

Comments
Post a Comment