Python wrapper for Google's Gemini CLI agentic capabilities
Project description
Gemini Agent
Python wrapper for Google's Gemini CLI agentic capabilities.
Installation
pip install gemini-agent # client only
pip install gemini-agent[core] # + direct CLI usage
pip install gemini-agent[server] # + REST API service
Requirements: Node.js 18+ and npm install -g @google/gemini-cli
Quick Start
export GEMINI_API_KEY=your_key
from gemini_agent.core import GeminiAgent
agent = GeminiAgent()
result = agent.run("Create a Python CLI that lists files")
print(result.response) # Gemini's response
print(result.modified_files) # {"cli.py": "import os..."}
Usage
Direct CLI Wrapper
from gemini_agent.core import GeminiAgent
agent = GeminiAgent(
model="gemini-2.5-flash", # optional
sandbox=True, # isolated execution
)
result = agent.run(
"Build a REST API with FastAPI",
mcp_servers=["filesystem"],
files={"spec.txt": "..."},
)
# result.success, result.response, result.modified_files
Python Client (Remote)
from gemini_agent.client import GeminiAgentClient
async with GeminiAgentClient("http://localhost:8000") as client:
result = await client.run("Create a hello world script")
print(result.modified_files)
REST API
podman-compose up -d --build
# Submit task
curl -X POST http://localhost:8000/tasks \
-H "Content-Type: application/json" \
-d '{"prompt": "Create a fibonacci function"}'
# Get result
curl http://localhost:8000/tasks/{task_id}
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST |
/tasks |
Submit task |
GET |
/tasks/{id} |
Get result |
DELETE |
/tasks/{id} |
Cancel task |
GET |
/health |
Health check |
GET |
/mcp/servers |
List MCP servers |
POST |
/mcp/servers |
Add MCP server |
Configuration
| Variable | Description |
|---|---|
GEMINI_API_KEY |
API key (required) |
GEMINI_MODEL |
Model override |
GEMINI_TIMEOUT |
Timeout in seconds (default: 300) |
REDIS_URL |
Redis URL for server mode |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gemini_cli_agent-0.1.0.tar.gz
(17.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gemini_cli_agent-0.1.0.tar.gz.
File metadata
- Download URL: gemini_cli_agent-0.1.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7412c1274cd8d3e328390f3ea64b8d3688faa000da82f2808e093fe5b2b011df
|
|
| MD5 |
131231e555a3ec41bac28bbe56aaf3e2
|
|
| BLAKE2b-256 |
2f50b3da2f444f7aef77b02e0510dc4e0ae04b414bbc9c40afd065ae1639f9d6
|
File details
Details for the file gemini_cli_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gemini_cli_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9b58ec5a20e897421db54fe4989edb756c5d9cbe3ab1ce7b0202ba28fd69dc7
|
|
| MD5 |
69a641fcf720c129fe9258c177109421
|
|
| BLAKE2b-256 |
c7386879aba3c63ef9efd72277559c7bf186fd3bfc19e54782192fc025425657
|