> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Connecting to TablePlus

> Inspect your pgvector container's sessions and knowledge tables with TablePlus.

Use TablePlus to inspect the tables Agno creates in your pgvector container: sessions, memories, and knowledge embeddings.

## Step 1: Start Your `pgvector` Container

```bash theme={null}
docker run -d \
  -e POSTGRES_DB=ai \
  -e POSTGRES_USER=ai \
  -e POSTGRES_PASSWORD=ai \
  -e PGDATA=/var/lib/postgresql \
  -v pgvolume:/var/lib/postgresql \
  -p 5532:5432 \
  --name pgvector \
  agnohq/pgvector:18
```

* `POSTGRES_DB=ai` sets the default database name.
* `POSTGRES_USER=ai` and `POSTGRES_PASSWORD=ai` define the database credentials.
* The container exposes port `5432`, mapped to `5532` on your local machine.

## Step 2: Create the Session Table

Agno creates database tables when a database-backed feature first uses them. Run this example to create the default `agno_sessions` table:

```python create_session.py theme={null}
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIResponses

db = PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai")

agent = Agent(
    model=OpenAIResponses(id="gpt-5.4-mini"),
    db=db,
)
agent.print_response("What is the capital of France?", session_id="tableplus-demo")
```

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno openai "psycopg[binary]" sqlalchemy
```

**2. Export your OpenAI API key**

```bash macOS / Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```powershell Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**3. Run the example**

Save the code as `create_session.py`, then run:

```bash theme={null}
python create_session.py
```

Only table types exercised against this database appear. Run the [Postgres memory guide](https://agno-v2.mintlify.site/memory/working-with-memories/postgres-memory.md) to create memory tables and the [PgVector guide](https://agno-v2.mintlify.site/knowledge/vector-stores/pgvector/overview.md) to create knowledge tables.

## Step 3: Configure TablePlus

1. Launch TablePlus.
2. Click the `+` icon to add a new connection.
3. Choose PostgreSQL as the database type.

Fill in the connection details:

* **Host**: `localhost`
* **Port**: `5532`
* **Database**: `ai`
* **User**: `ai`
* **Password**: `ai`

![TablePlus PostgreSQL connection settings](https://mintcdn.com/agno-v2/yeT29TzCG5roT0hQ/images/tableplus.png?fit=max\&auto=format\&n=yeT29TzCG5roT0hQ\&q=85\&s=65f0ec170fdef92080bdc0e72feaacc4)


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