open-index/open-npm huggingface dataset:
npm package: @hauson/postgres-runner
Description: Postgres-backed agent runner for CopilotKit2
Latest version: 0.0.3

# @copilotkitnext/postgres-runner

Postgres-backed `AgentRunner` implementation for CopilotKit2. This package mirrors the behavior of `@copilotkitnext/sqlite-runner`, but persists run history in Postgres.

## Install

`pg` is a runtime dependency (declared as an optional peer dependency).

```sh
pnpm add @copilotkitnext/postgres-runner pg
```

## Usage

```ts
import { PostgresAgentRunner } from "@copilotkitnext/postgres-runner";

const runner = new PostgresAgentRunner({
  connectionString: process.env.DATABASE_URL,
});
```

You may also pass an existing `pg.Pool` via `{ pool }` to reuse connections.

## Local testing (Docker)

From `packages/postgres-runner`:

```sh
docker compose up -d
```

Default connection string used by tests:

```txt
postgres://postgres:postgres@localhost:54329/copilotkit_postgres_runner_test
```

Override with:

```sh
export POSTGRES_RUNNER_DATABASE_URL="postgres://user:pass@host:port/db"
```

Then run:

```sh
pnpm test
```