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

# Installation

> Install GitAgent, system requirements, and environment setup.

## System requirements

* Python 3.9 or later
* Git 2.20 or later
* 512 MB RAM minimum (2 GB recommended for agents with local memory)

## Install via pip

```bash theme={null}
pip install gitagent
```

Verify the installation:

```bash theme={null}
gitagent --version
# gitagent 0.8.0
```

## Install with extras

GitAgent has optional extras for specific use cases:

```bash theme={null}
# Local embeddings for memory (adds sentence-transformers)
pip install "gitagent[memory]"

# All extras
pip install "gitagent[all]"
```

## Install from source

```bash theme={null}
git clone https://github.com/LyzrCore/gitagent
cd gitagent
pip install -e ".[dev]"
```

## Updating

```bash theme={null}
pip install --upgrade gitagent
```

After major version upgrades, run:

```bash theme={null}
gitagent migrate
```

This updates any `agent.yaml` files in the current directory to the latest schema version.

## Environment variables

| Variable                | Required        | Description                                                   |
| ----------------------- | --------------- | ------------------------------------------------------------- |
| `OPENAI_API_KEY`        | If using OpenAI | OpenAI API key                                                |
| `ANTHROPIC_API_KEY`     | If using Claude | Anthropic API key                                             |
| `GITAGENT_MODEL`        | No              | Default model to use (overrides `agent.yaml`)                 |
| `GITAGENT_LOG_LEVEL`    | No              | Log level: `DEBUG`, `INFO`, `WARNING`, `ERROR`                |
| `GITAGENT_MEMORY_PATH`  | No              | Path for local memory storage (default: `~/.gitagent/memory`) |
| `GITAGENT_PLUGINS_PATH` | No              | Extra directory to scan for plugins                           |

## Model provider setup

### OpenAI

```bash theme={null}
export OPENAI_API_KEY=sk-...
```

In `agent.yaml`:

```yaml theme={null}
model:
  provider: openai
  name: gpt-4o          # or gpt-4o-mini, gpt-4-turbo, etc.
```

### Anthropic

```bash theme={null}
export ANTHROPIC_API_KEY=sk-ant-...
```

In `agent.yaml`:

```yaml theme={null}
model:
  provider: anthropic
  name: claude-3-5-sonnet-20241022
```

### Azure OpenAI

```bash theme={null}
export AZURE_OPENAI_API_KEY=...
export AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
```

In `agent.yaml`:

```yaml theme={null}
model:
  provider: azure-openai
  name: gpt-4o             # deployment name
  api_version: "2024-02-01"
```

### Local models (Ollama)

```bash theme={null}
# Start Ollama with your model
ollama serve
ollama pull llama3.2
```

In `agent.yaml`:

```yaml theme={null}
model:
  provider: ollama
  name: llama3.2
  base_url: http://localhost:11434
```

## CI/CD installation

### GitHub Actions

```yaml theme={null}
- name: Install GitAgent
  run: pip install gitagent

- name: Run agent
  run: gitagent run "${{ github.event.inputs.prompt }}"
  env:
    OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
```

### Docker

```dockerfile theme={null}
FROM python:3.11-slim
RUN pip install gitagent
WORKDIR /agent
COPY . .
CMD ["gitagent", "run"]
```

## Troubleshooting

**`gitagent: command not found`**

Python scripts directory is not in PATH. Add it:

```bash theme={null}
# macOS/Linux
export PATH="$PATH:$(python -m site --user-base)/bin"

# Or install in a virtual environment
python -m venv .venv && source .venv/bin/activate
pip install gitagent
```

**`agent.yaml not found`**

Run `gitagent` from the directory that contains `agent.yaml`, or pass the path explicitly:

```bash theme={null}
gitagent run --agent-dir /path/to/my-agent "your prompt"
```

**Model errors / authentication failures**

Verify your API key is set and valid:

```bash theme={null}
gitagent doctor
```

`gitagent doctor` checks: Python version, API key validity, model connectivity, and directory structure compliance.
