# Install

<span id="from-a-checkout"></span>
<span id="release-status"></span>

## Install gvn {#install-gvn}

gvn is on PyPI under the name `gvn`:

```bash
pip install gvn
```

In a project managed by [uv](https://docs.astral.sh/uv/), use `uv add gvn`. Then
[run your first agent](start.md).

## What you are installing

The core package is `gvn`. The `gvn-domains` and `gvn-tools` companion packages provide
example harnesses and ready-made tools:

```mermaid
flowchart LR
    domains["<b>gvn-domains</b><br/>complete example harnesses"]
    tools["<b>gvn-tools</b><br/>ready-made tools"]
    subgraph core ["<b>gvn</b> (required)"]
        direction TB
        kernel["gvn.kernel<br/>state machines and the verifier"]
        harness["gvn.harness<br/>actors: the agent, workflows, ..."]
        runtime["gvn.runtime<br/>the Governor"]
        adapters["gvn.adapters<br/>vendor models, journals, logs"]
        testing["gvn.testing<br/>fakes for tests"]
    end
    domains --> core
    tools --> core
```

The modules of `gvn` match the boxes of the [big picture](index.md#gvn-at-a-glance):

- `gvn.kernel`: state machines, the verifier that checks them, and decisions (the objects
  through which a machine branches on data).
- `gvn.harness`: the actors (the ready-made agent, workflows, conversations and others),
  tools, and the **ports**: the interfaces through which a run reaches the outside world
  (the model, the journal, the clock, where progress is reported).
- `gvn.runtime`: the Governor, which drives a run and records it in the journal, and its
  fulfillers, the objects that do each kind of work the actor asks for.
- `gvn.adapters`: real implementations of the ports, one module per outside system (a
  vendor's model, a SQLite or PostgreSQL journal, logging, tracing).
- `gvn.testing`: fakes of every port, so tests run offline.

You will meet each of them in the [quickstart](quickstart.md) and the tutorials; you do not
need to know them to install.

## Requirements

gvn requires Python 3.12 or newer.

The core package has no runtime dependencies. Everything in `gvn.kernel`, `gvn.harness`,
`gvn.runtime` and `gvn.testing` uses the standard library only, and so do two adapters: the
SQLite journal (`gvn.adapters.sqlite`) and the structured-logging output
(`gvn.adapters.logs`).

## Optional extras

Some adapters need a third-party library. Each comes as an optional **extra** (a named set
of optional dependencies, written in square brackets after the package), and each extra adds
one dependency:

| Extra | Adds | Use it for |
|---|---|---|
| `anthropic` | `anthropic` | `gvn.adapters.anthropic.AnthropicModel`, Anthropic's models |
| `openai` | `openai` | `gvn.adapters.openai.OpenAIModel`, OpenAI's models, and `gvn.adapters.chat_completions.ChatCompletionsModel`, any model service with a Chat Completions endpoint (DeepSeek, for one) |
| `otel` | `opentelemetry-api` | `gvn.adapters.otel.TracingOutput`, which reports a run as OpenTelemetry spans (tracing records) |
| `postgres` | `psycopg[binary,pool]` (psycopg 3) | `gvn.adapters.postgres.PostgresJournal` and `PostgresLeases`, a journal in PostgreSQL shared by several processes, and `PostgresMemory`, a memory they share; see [Running as a service](guides/running-as-a-service.md) and [Memory](concepts/memory.md#shared-memory-postgresmemory) |

Name the extras you want in square brackets when you install:

```bash
pip install "gvn[anthropic]"
pip install "gvn[openai,postgres]"
```

The `otel` extra installs the OpenTelemetry API only. To export spans you also need an
OpenTelemetry SDK or your vendor's distribution, configured by you; see
[Logs, traces and streams](guides/observability.md).

The companion packages install the same way, with `pip install gvn-domains` and
`pip install gvn-tools`. The [example harnesses](domains/index.md) and
[ready-made tools](tools/index.md) describe their own dependencies.

## Check the install

To check the install, build a small state machine: a light switch with two states, `off`
and `on`, and one input, `flip`. If gvn is installed, this prints the checked machine's
name, its style (`moore`) and a fingerprint, a short code computed from the whole machine:

```python
from gvn.kernel.blueprint import MooreBlueprint

switch = (
    MooreBlueprint(name="switch")
    .inputs("flip")
    .outputs("dark", "lit")
    .state(name="off", output="dark")
    .state(name="on", output="lit", final=True)
    .initial(name="off")
    .on(source="off", input="flip", target="on")
    .build()
)
print(switch)  # Definition('switch', moore, <fingerprint>)
```

The [quickstart](quickstart.md) explains what each line means, and
[tutorial 1](tutorials/first-machine.md) takes it slowly.

## Working on gvn itself

The repository is a [uv workspace](https://docs.astral.sh/uv/concepts/projects/workspaces/):
one repository holding several packages that uv installs together.
The workspace defines two dependency groups:

| Group | Holds | Installed by |
|---|---|---|
| `dev` | gvn with every extra, gvn-domains, gvn-tools with its `http` and `mcp` extras, the OpenTelemetry SDK, pytest and its plugins, hypothesis, import-linter, ruff | `uv sync` (the default group) |
| `docs` | MkDocs Material | `uv run --group docs ...` |

From the repository root:

```bash
uv sync                    # creates .venv with all three packages, every extra, and the dev tools
uv run pytest              # the whole suite: parallel, random order, no network
uv run lint-imports        # the architecture contracts: which layer may import which
uv run ruff check .        # lint
```

The default test run excludes three opt-in markers: `integration` (needs a real external
service), `live` (calls a real vendor) and `scale` (the large benchmark). Select one with
`-m`, for example `uv run pytest -m integration`.

The public documentation site uses Astro, with the MkDocs renderer for the source Markdown.
From the repository root, use Node 22.19 or newer to preview or build the site:

```bash
npm --prefix website ci
npm --prefix website run dev
npm --prefix website run build
```

The docs tests execute offline walkthroughs in order. The standalone recipes also run as
separate Python files with checked output. Examples labeled as provider setup require the
listed credentials or services.
