Skip to main content

A framework for building agents that use Gemini's function calling capabilities

Project description

Gemini Agent Framework

A powerful Python framework for building intelligent agents using Google's Gemini API. This framework simplifies the creation of agents that can break down complex tasks into sequential steps using available tools, with support for function calling, variable management, and structured responses.

Features

  • 🛠️ Easy Tool Definition: Define tools using simple decorators
  • 🔄 Sequential Task Breakdown: Automatically breaks down complex tasks into manageable steps
  • 📦 Variable Management: Store and manage variables with metadata
  • 🎯 Structured Responses: Define response structures for consistent outputs
  • 🔍 Intermediate Results: Access and manage intermediate results
  • 🛡️ Error Handling: Built-in error handling and recovery mechanisms
  • 🔌 Extensible: Easy to extend with custom tools and functionality

Installation

pip install gemini-agent-framework

Quick Start

from gemini_agent import Agent
from dotenv import load_dotenv

load_dotenv()

# Define your tools
@Agent.description("Multiplies two numbers.")
@Agent.parameters({
    'a': {'type': int, 'description': 'The first number'},
    'b': {'type': int, 'description': 'The second number'}
})
def multiply(a: int, b: int) -> int:
    return a * b

# Create an agent instance
agent = Agent(api_key="your-api-key", tools=[multiply])

# Use the agent
response = agent.prompt("Multiply 3 and 7")
print(response)  # Should output 21

Advanced Usage

Variable Management

# Store variables with metadata
agent.set_variable("user_name", "John", "The current user's name", str)
agent.set_variable("last_login", datetime.now(), "Last login timestamp", datetime)

# Retrieve variables
name = agent.get_variable("user_name")

Structured Responses

response_structure = {
    "result": {"type": "number"},
    "explanation": {"type": "string"}
}

response = agent.prompt(
    "Calculate 5 * 7 and explain the process",
    response_structure=response_structure
)

Custom System Prompts

system_prompt = """
You are a helpful assistant that specializes in mathematical calculations.
Always show your work and explain your reasoning.
"""

response = agent.prompt(
    "Solve 15 * 23",
    system_prompt=system_prompt
)

Documentation

For detailed documentation, please visit our documentation site.

Key Topics

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

  1. Clone the repository
  2. Install development dependencies:
    pip install -e ".[dev]"
    
  3. Run tests:
    pytest
    

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Citation

If you use this framework in your research, please cite:

@software{gemini_agent_framework,
  author = {Mohamed Baathman},
  title = {Gemini Agent Framework},
  year = {2025},
  url = {https://github.com/m7mdony/gemini-agent-framework}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemini_agent_framework-0.2.2.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemini_agent_framework-0.2.2-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file gemini_agent_framework-0.2.2.tar.gz.

File metadata

  • Download URL: gemini_agent_framework-0.2.2.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for gemini_agent_framework-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b55b0e313e90f4220af4175163a8103ea80af3ec97e6c5af39e65d6b32af8d6d
MD5 e19b1b4fea39bd49a09af65d4ce2b454
BLAKE2b-256 1f65f38fa431983cea143fbee03ac959bc0256c7daadde709aba8ef70f9d2f54

See more details on using hashes here.

File details

Details for the file gemini_agent_framework-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for gemini_agent_framework-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e84aa55fa2cf708c5eab89b1bbbd71d4e9564b09dc453ce3942059bbe1bac838
MD5 1333ca656a2ee18051c2bf29cd74d227
BLAKE2b-256 4b8c9f5c5d2d115cfd1d64b6a9a39735031f7229ef76f0008b6e11f65d0c88cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page