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

# Persistence CLI

> CLI commands for database persistence

# Persistence CLI

Command-line interface for database persistence management.

## Installation

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
pip install "praisonai[tools]"
```

## Commands

### Help

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai persistence --help
```

### Doctor

Validate database connectivity.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai persistence doctor [options]
```

**Options:**

| Option                   | Description                |
| ------------------------ | -------------------------- |
| `--conversation-url URL` | Conversation store URL     |
| `--knowledge-url URL`    | Knowledge store URL        |
| `--state-url URL`        | State store URL            |
| `--all`                  | Test all configured stores |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai persistence doctor \
    --conversation-url "postgresql://postgres:pass@localhost/db" \
    --knowledge-url "http://localhost:6333" \
    --state-url "redis://localhost:6379"
```

### Run

Run an agent with persistence.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai persistence run [options] "prompt"
```

**Options:**

| Option                      | Description                          |
| --------------------------- | ------------------------------------ |
| `--session-id ID`           | Session identifier                   |
| `--user-id ID`              | User identifier (default: "default") |
| `--conversation-url URL`    | Conversation store URL               |
| `--knowledge-url URL`       | Knowledge store URL                  |
| `--state-url URL`           | State store URL                      |
| `--agent-name NAME`         | Agent name (default: "Assistant")    |
| `--agent-instructions TEXT` | Agent instructions                   |
| `--dry-run`                 | Show config without running          |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai persistence run \
    --session-id "my-session" \
    --conversation-url "postgresql://localhost/db" \
    "Hello, my name is Alice"
```

### Resume

Resume an existing session.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai persistence resume --session-id ID [options]
```

**Options:**

| Option                   | Description                  |
| ------------------------ | ---------------------------- |
| `--session-id ID`        | Session to resume (required) |
| `--conversation-url URL` | Conversation store URL       |
| `--show-history`         | Display conversation history |
| `--continue "prompt"`    | Continue with new prompt     |

**Example:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Show history
praisonai persistence resume \
    --session-id "my-session" \
    --conversation-url "postgresql://localhost/db" \
    --show-history

# Continue conversation
praisonai persistence resume \
    --session-id "my-session" \
    --conversation-url "postgresql://localhost/db" \
    --continue "What's my name?"
```

## Environment Variables

| Variable                   | Description                    |
| -------------------------- | ------------------------------ |
| `PRAISON_CONVERSATION_URL` | Default conversation store URL |
| `PRAISON_KNOWLEDGE_URL`    | Default knowledge store URL    |
| `PRAISON_STATE_URL`        | Default state store URL        |
| `OPENAI_API_KEY`           | OpenAI API key for agent       |

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export PRAISON_CONVERSATION_URL="postgresql://localhost/db"
export OPENAI_API_KEY="your-key"

# Now commands are simpler
praisonai persistence doctor --all
praisonai persistence run --session-id "my-session" "Hello!"
```

## Troubleshooting

**Connection refused:**

* Check Docker containers are running
* Verify URL format and credentials

**No API key:**

* Set `OPENAI_API_KEY` environment variable
