Skip to content

Repository files navigation

Gemini Interactions API Samples

This directory contains reference implementations of AI Agents refactored from the Google Agent Development Kit (ADK).

These samples demonstrate the "Gemini 3" / Native Agentic architecture, where the orchestration logic (loops, state management, tool selection) is offloaded from client-side frameworks to the model itself via the Interactions API.

🚀 Setup

  1. Install the SDK This requires the new google-genai library (v1beta).

    pip install google-genai
  2. Set your API Key You need a Gemini API key.

    export GEMINI_API_KEY="your_api_key_here"

📂 The Agents

1. Customer Service Agent (interactions_customer_service.py)

  • Concept: Stateful, transactional bot with many tools.
  • Key Feature: Demonstrates Automatic Function Calling. The model autonomously calls tools like check_product_availability and modify_cart to solve user requests.
  • Run:
    python interactions_customer_service.py

2. Software Bug Assistant (interactions_software_assistant.py)

  • Concept: Integration Agent connecting to external systems (Mocked).
  • Key Feature: Demonstrates API Integration. The agent acts as a bridge between a user and systems like a Ticket Database or StackOverflow.
  • Run:
    python interactions_software_assistant.py

3. Data Science Router (interactions_data_science.py)

  • Concept: Hierarchical / Routing Agent.
  • Key Feature: Demonstrates Native Reasoning. The model decides whether to query a SQL database (BigQuery) or perform Python analysis, without hardcoded "Router" logic. Watch the [Root Agent Reasoning] logs.
  • Run:
    python interactions_data_science.py

4. Red Teaming / Security (interactions_red_teaming.py)

  • Concept: Multi-Agent Orchestration.
  • Key Feature: Demonstrates Workflow Planning. A single "Orchestrator" model manages a team of virtual sub-agents (Red Team, Target, Evaluator) by calling them as functions.
  • Run:
    python interactions_red_teaming.py

5. RAG / Knowledge Agent (interactions_rag_agent.py)

  • Concept: Retrieval Augmented Generation.
  • Key Feature: Demonstrates the Production Gap. While the model knows when to search, the infrastructure code (retrieve_rag_documentation) must still be implemented by the developer using frameworks or libraries.
  • Run:
    python interactions_rag_agent.py

📝 Key Learnings for "Agentic Reasoning"

  • Logic: Moved from Python (while loops) to Model (output.thought).
  • State: Moved from Python (messages=[]) to API (interaction_id).
  • Code: Significantly reduced boilerplate compared to framework-based implementations.

About

Samples for Interactions API

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages