> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc.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")
```

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai "psycopg[binary]" sqlalchemy
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```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"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code as `create_session.py`, then run:

    ```bash theme={null}
    python create_session.py
    ```
  </Step>
</Steps>

Only table types exercised against this database appear. Run the [Postgres memory guide](/memory/working-with-memories/postgres-memory) to create memory tables and the [PgVector guide](/knowledge/vector-stores/pgvector/overview) 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`

<img src="https://mintcdn.com/phidatainc/JUdd69R_GtzOgSkJ/images/tableplus.png?fit=max&auto=format&n=JUdd69R_GtzOgSkJ&q=85&s=4ab50a5f8ef6d35683045163773640a6" alt="TablePlus PostgreSQL connection settings" width="492" height="386" data-path="images/tableplus.png" />
