Skip to content

bperin/agent

Repository files navigation

Multi-Tool Agent: Food Ordering Concierge

This project demonstrates a sophisticated multi-agent system built with the Google ADK framework. The main agent acts as a friendly food ordering concierge that orchestrates specialist sub-agents to help users browse menus, place orders, and process payments.

Conversation Flow

For a detailed breakdown of the agent's conversation, see the following documents:

Architecture

The system is composed of several key components:

  • Orchestrator Agent (agent.py): The main agent that manages the overall conversation and delegates tasks to the appropriate sub-agent.
  • Menu Agent (menu_agent.py): A specialist sub-agent for browsing restaurant menus and managing a food order.
  • Payment Agent (payment_agent.py): A specialist sub-agent for handling credit card payments.
  • RAG Ingestion Engine (rag_ingestion_engine/): A modular system for loading and processing data. In this project, it's used to load a list of contacts from numbers.json.
  • Centralized Configuration:
    • Prompts (prompts.py): All agent instructions are centralized in this file for easy maintenance.
    • Models (config.py): The Gemini model names used by the agents are defined here, allowing for easy switching and configuration.

Key Features

This project demonstrates several key concepts in building sophisticated, multi-agent systems:

  • Agent Orchestration: The root_agent acts as an orchestrator, delegating tasks to specialized sub-agents (menu_agent, payment_agent). This is a powerful pattern for building complex, maintainable agents.
  • RAG (Retrieval-Augmented Generation): The agent uses a RAG engine to retrieve restaurant and menu information from a JSON file, demonstrating how to ground an agent's responses in external data.
  • Payment Processing: The payment_agent showcases how to integrate with external systems (in this case, a mock Square API) to perform actions like processing payments.
  • State Management: Agents maintain persistent state throughout conversations using ToolContext. The menu_agent tracks order items, quantities, and totals, while the payment_agent manages payment status (pending, completed, failed) and transaction details.
  • Automatic Upselling: The menu system proactively suggests relevant combos and upsell items after each menu item is added to the order, encouraging customers to spend more without being asked.
  • Centralized Prompts and Configuration: All prompts and model configurations are stored in dedicated files, making the system easy to maintain and update.

Getting Started

Follow these steps to set up and run the agent.

1. Installation

This project uses Poetry for dependency management. To install the required libraries, run:

poetry install

2. Configuration

You need to provide a Google API key for the agent to function correctly.

  1. Create a file named .env in the multi-tool-agent directory.
  2. Add your API key to the file like this:
GOOGLE_API_KEY="your_gemini_api_key_here"
  1. Load the environment variables into your shell session by running:
source multi-tool-agent/.env

3. Running the Agent

The Google ADK framework provides a web server to interact with the agent. To run the agent, use the following command:

make run

This will start a local web server. You can open the provided URL in your browser to chat with the agent.

4. Cleaning the Project (Optional)

If you encounter issues with outdated cached files, you can clean the project by running the make clean command. This will remove all __pycache__ directories.

make clean

About

Slap Agent

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published