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
- Clone the repository
- Install development dependencies:
pip install -e ".[dev]"
- 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}
}
Metadata
Release files for gemini-agent-framework 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gemini_agent_framework-1.0.0.tar.gz | 45.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gemini_agent_framework-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.7 kB
Release files / gemini_agent_framework-1.0.0.tar.gz
| Download URL | gemini_agent_framework-1.0.0.tar.gz |
|---|---|
| Size | 45.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07d9c191644aee58e83f78746bfcbb4c6497d8ecd71a65d232762ce1849cb233
|
|
BLAKE2b-256 checksum How to use checksums |
8417ad8e5556340af3eca98aa03df7d9cc9ff12548dabc02bc65d192e654eb47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Release files / gemini_agent_framework-1.0.0-py3-none-any.whl
| Download URL | gemini_agent_framework-1.0.0-py3-none-any.whl |
|---|---|
| Size | 31.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a597dbdd3da41d53ae4fd8c2664d355adad9806bdea65869f7df45f34311068
|
|
BLAKE2b-256 checksum How to use checksums |
0cd04129793a5b0f88bb61d259fb52a391f90cf63d2f4e5b2a1e2472b29a3f90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Security for gemini-agent-framework 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.