> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Gemini

> Use Google Gemini models with PraisonAI Agents

## Environment Variables

Setting `MODEL_NAME=google/gemini-1.5-pro` is enough — no need to set `OPENAI_BASE_URL`. The `GOOGLE_API_KEY` environment variable is consulted; `OPENAI_API_KEY` is **not** used as a fallback. Note that `gemini/` prefix also works and uses `GEMINI_API_KEY`.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import os
from praisonaiagents import Agent

os.environ["MODEL_NAME"] = "google/gemini-1.5-pro"
os.environ["GOOGLE_API_KEY"] = "your-google-key"

agent = Agent(name="Gemini Agent", instructions="You are powered by Gemini")
```

## Models

* **Recommended**: `gemini/gemini-2.5-flash` (latest, best balance)
* **Fast/Cheap**: `gemini/gemini-2.0-flash-lite` (fastest)
* **Pro**: `gemini/gemini-2.5-pro` (highest quality)
* **Thinking**: `gemini/gemini-2.0-flash-thinking-exp` (reasoning)
* **Legacy**: `gemini/gemini-1.5-flash`, `gemini/gemini-1.5-pro`

## Python

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# export GEMINI_API_KEY=your-api-key
from praisonaiagents import Agent

agent = Agent(
    instructions="You are a helpful assistant",
    llm="gemini/gemini-2.5-flash"
)
agent.start("Explain machine learning")
```

### With Tools

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# export GEMINI_API_KEY=your-api-key
from praisonaiagents import Agent

def search_web(query: str) -> str:
    """Search the web for information."""
    return f"Search results for: {query}"

agent = Agent(
    instructions="You are a research assistant",
    llm="gemini/gemini-2.5-flash",
    tools=[search_web]
)
agent.start("Find information about renewable energy")
```

### Multi-Agent

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# export GEMINI_API_KEY=your-api-key
from praisonaiagents import Agent, Task, AgentTeam

researcher = Agent(
    instructions="You research topics thoroughly",
    llm="gemini/gemini-2.5-pro"
)
writer = Agent(
    instructions="You write clear content",
    llm="gemini/gemini-2.5-flash"
)

task1 = Task(description="Research climate change", agent=researcher)
task2 = Task(description="Write a summary", agent=writer)

agents = AgentTeam(agents=[researcher, writer], tasks=[task1, task2])
agents.start()
```

### Thinking Model

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# export GEMINI_API_KEY=your-api-key
from praisonaiagents import Agent

agent = Agent(
    instructions="You are a problem solver",
    llm={
        "model": "gemini/gemini-2.0-flash-thinking-exp",
        "response_format": {"type": "text"}
    }
)
agent.start("Solve this logic puzzle...")
```

## CLI

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export GEMINI_API_KEY=your-api-key

# Basic prompt
python -m praisonai "Explain AI" --llm gemini/gemini-2.5-flash

# With temperature
python -m praisonai "Write a poem" --llm gemini/gemini-2.5-flash --temperature 0.9

# Run agents.yaml
python -m praisonai
```

## YAML

```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
framework: praisonai
topic: Research technology trends
agents:
  researcher:
    role: Tech Researcher
    goal: Find latest technology developments
    instructions: You are an expert technology researcher
    llm:
      model: gemini/gemini-2.5-pro
    tasks:
      research_task:
        description: Research the latest trends in AI and technology
        expected_output: Comprehensive technology report

  writer:
    role: Content Writer
    goal: Create engaging summaries
    instructions: You write clear and engaging content
    llm:
      model: gemini/gemini-2.5-flash
    tasks:
      write_task:
        description: Write a summary of the research findings
        expected_output: Well-written summary article
```
