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

# Running Guava Agents On-Device with Guava Edge

> Run voice agents fully offline on your Mac

Guava Edge runs speech recognition, the language model, and text-to-speech on your own Mac. No audio or data leaves the machine, and no API key is needed. Guava Edge is in developer preview, and is free for non-commercial use.

> [card] At a Glance
>
> 1. Install the Guava CLI with `brew install goguava-ai/tap/guava`.
> 2. Run `guava run --edge` to install Guava Edge and talk to a demo agent.
> 3. Scaffold your own agent with `guava create --edge my-agent`.
> 4. Run it with `cd my-agent && guava run --edge`.

## Requirements

Guava Edge runs every model on the Mac's Neural Engine and GPU, so the chip is the main requirement.

* Apple silicon, M4 or later.
* macOS with 16 GB of memory or more.
* About 4 GB of free disk space.

> [!WARNING]
>
> M1 and M2 Macs are not supported. M3 Macs run with degraded performance: expect higher response latency and occasional audio dropouts.

Edge agents use the Python SDK. The TypeScript SDK does not support Guava Edge.

## Install the CLI

> [tab] Homebrew
>
> ```bash theme={null}
> brew install goguava-ai/tap/guava
> ```

> [tab] Install script
>
> ```bash theme={null}
> curl -fsSL https://goguava.ai/install.sh | sh
> ```

## Try the demo

Run `guava run --edge` outside of an agent project to start the built-in demo.

```bash theme={null}
guava run --edge
```

The first run installs Guava Edge:

1. Your browser opens the Guava Edge terms of use. Agree with your email address, and the CLI continues on its own.
2. The CLI downloads the Guava Edge server and audio binaries, sets up an isolated Python 3.13 environment, and downloads the speech, language, and voice models. This is about 4 GB.

The demo greets you once it's ready. Say goodbye to end the conversation, press Enter to start another, and press Ctrl-C to quit.

## Create an agent

Scaffold an edge project with `guava create --edge`.

```bash theme={null}
guava create --edge my-agent
```

This creates `main.py`, `pyproject.toml`, `README.md`, and `guava-docs.md`, a reference for AI coding assistants. The generated `main.py` looks like this:

```python main.py theme={null}
import logging

import guava
from guava import logging_utils

logger = logging.getLogger("guava.edge_agent")

agent = guava.Agent(
    name="Guava",
    purpose=(
        "You're an example voice agent running entirely on the user's own machine "
        "with Guava Edge. Be warm and brief, a sentence or two at a time."
    ),
)


@agent.on_wakeword
@agent.on_press_enter
def on_wake(call: guava.Call) -> None:
    logger.info("Woken up (session: %s)", call.id)
    call.set_task(
        "intro",
        objective=(
            "Let the user know their on-device agent is working, then chat until "
            "they're done."
        ),
        checklist=[
            guava.Say(
                "Hi! I'm a Guava voice agent running right here on your computer."
            ),
            guava.Field(
                key="user_name",
                field_type="text",
                description="Ask the user for their name so you can address them personally.",
                required=False,
            ),
            "Chat with the user until they have nothing more to say.",
        ],
    )


@agent.on_task_complete("intro")
def on_intro_complete(call: guava.Call) -> None:
    call.hangup("Say a friendly goodbye.")


if __name__ == "__main__":
    logging_utils.configure_logging()
    # Waits for the wake word or Enter, runs a call, then goes back to listening.
    agent.listen_for_wake()
```

Tasks, fields, and handlers work the same way as they do for cloud agents. See [Tasks](https://docs.goguava.ai/sdk-reference/tasks.md) and [Field](https://docs.goguava.ai/sdk-reference/field.md) for details.

## Run your agent

```bash theme={null}
cd my-agent
guava run --edge
```

`guava run --edge` starts the local Guava Edge server, points the SDK at it, and runs `main.py`. The first run installs the project's dependencies, including `guava-sdk[wakeword]`, which can take a few minutes.

Say "Hey Guava" or press Enter to start a conversation. When it ends, the agent goes back to waiting.

> [!NOTE]
>
> Always run edge agents with `guava run --edge`. The wake triggers and `listen_for_wake()` raise a `RuntimeError` if you run `main.py` directly with `python` or `uv run`.

## Wake triggers

Edge agents don't take phone calls. Instead, a wake trigger starts a conversation through the local microphone and speaker. Each trigger calls its handler with a `guava.Call` once the conversation starts, just like `on_call_start` does for cloud agents.

You can register any mix of triggers, or stack several decorators on one handler. The first trigger to fire starts the conversation, and the rest are ignored until it ends.

### `on_wakeword`

Starts a conversation when someone says the wake word. Detection runs on the local microphone, and the bundled model answers to "Hey Guava".

```python theme={null}
@agent.on_wakeword  # "Hey Guava"
def on_wake(call: guava.Call):
    call.set_task("help", objective="Ask how you can help.")

# Or answer to your own wake word.
@agent.on_wakeword(model="./models/hey_nova.onnx")
def on_wake(call: guava.Call):
    ...
```

`model` is an optional path to a nanowakeword-compatible ONNX model. The model loads when the decorator runs, so a bad path fails at startup instead of at the first wake. Listening pauses during a conversation and resumes when it ends.

### `on_press_enter`

Starts a conversation when you press Enter in the terminal running the agent. This is the simplest trigger to use during development.

```python theme={null}
@agent.on_press_enter
def on_wake(call: guava.Call):
    call.set_task("help", objective="Ask how you can help.")
```

This trigger needs an interactive terminal. If stdin is closed, the trigger stops. If you're running under a service manager, use `on_wakeword` or `on_wake` instead.

### `on_wake`

Starts a conversation when your own function returns. Use it for a hardware button, a sensor, a timer, or anything else that can block until it's time to talk.

```python theme={null}
import time

def wait_for_dry_soil():
    while read_moisture() > 30:  # Replace with your sensor read.
        time.sleep(60)

@agent.on_wake(trigger=wait_for_dry_soil)
def on_wake(call: guava.Call):
    call.set_task("water", objective="Tell the user the plant needs water.")
```

`trigger` runs on a background thread. It's called once at startup, and again after each conversation ends. If it raises, the error is logged and the trigger stops for the rest of the process, so handle any errors you expect to recover from inside it. `on_wake` always takes `trigger=...`, so a bare `@agent.on_wake` is an error.

### `listen_for_wake`

`agent.listen_for_wake()` starts every registered trigger and blocks. Pass `variables={...}` to seed each conversation's variables, then read them with [`call.get_variable`](https://docs.goguava.ai/sdk-reference/get-set-variable).

```python theme={null}
agent.listen_for_wake(variables={"store": "Guava Coffee"})
```

If no triggers are registered, `listen_for_wake()` logs a warning and returns immediately.

## Features not available on Guava Edge

These are cloud features, and don't work in edge agents:

* Phone numbers, SIP, WebRTC, and campaigns. Use `listen_for_wake()` instead of `listen_phone`, `listen_webrtc`, `listen_sip`, or `call_phone`.
* [`transfer`](https://docs.goguava.ai/sdk-reference/transfer), [`reach_person`](https://docs.goguava.ai/sdk-reference/reach-person), [`set_voicemail_action`](https://docs.goguava.ai/sdk-reference/set-voicemail-action), and DTMF.
* SMS and the REST APIs.
* Helpers that call Guava's hosted API: [`DocumentQA`](https://docs.goguava.ai/sdk-reference/document-qa), the [intent helpers](https://docs.goguava.ai/sdk-reference/intent-helpers.md), and [`DatetimeFilter`](https://docs.goguava.ai/sdk-reference/datetime-filter). If you need retrieval or an LLM, run one locally.

The on-device models are smaller than the ones in the cloud, so short, concrete task objectives and checklists matter more here.

## Updating and uninstalling

`guava run --edge` only installs what's missing. To update the Guava Edge binaries and models, run:

```bash theme={null}
guava edge install
```

Guava Edge installs everything into `~/Library/Application Support/.guava/`. Delete that folder to uninstall.

## Troubleshooting

* **Asked to log in, or seeing "could not check EULA status".** Your CLI is out of date. Run `brew upgrade guava`, or `guava self-upgrade` if you used the install script.
* **The server fails to start.** Guava Edge uses ports 8080 and 7010. Check that another Guava Edge server, or another app, isn't already using them.
* **`RuntimeError` when starting the agent.** Run the agent with `guava run --edge` instead of `python main.py`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.