---
sidebar_label: AI assistant
toc_max_heading_level: 3
doc_id: b5e2f4a8-7c91-4d3b-a608-1f9e3c5d2b47
description: >-
  An AI assistant embedded in the nullplatform console. Ask questions, explore
  resources, investigate failures, and generate CLI commands or configurations
  without leaving the platform.
keywords:
  - AI assistant
  - AI chat
  - nullplatform assistant
  - CLI generation
  - troubleshooting
  - platform chat
---

import { LiteYouTube } from '@site/src/components/FeatureHighlight';

# AI assistant

:::info 🚀 Early release

AI Ops features are in early release and may not be available in your organization yet. If you'd like to try them or want to know more, [reach out to us](https://docs.nullplatform.com/docs/support) and we'll get you set up.
:::

The **nullplatform AI assistant** is a chat panel embedded directly in the console. You can ask questions about your applications, deployments, and scopes, generate `np` CLI commands on demand, and investigate failures, all without leaving your current view.

## What you can do

> 💡 The assistant responds in the same language you write in, including English, Spanish, and more.


- **Explore resources**: applications, deployments, scopes, and builds
- **Investigate failures**: current state, recent changes, and audit logs
- **Generate CLI commands**: ready-to-run `np` commands and shell scripts

:::warning The assistant is read-only

 It **can't create, update, or delete** resources directly. For write operations, it generates the command or script for you to run.

:::

Click the **AI assistant** icon in nullplatform to open the chat panel and ask a question.

<LiteYouTube videoId="Rn3eNERS4x0" videoTitle="Context-aware AI assistant | nullplatform" />

## You don't need to provide IDs or context

The **assistant knows what entity you're currently viewing.** If you're on a deployment page, a question like "Why did this fail?" is enough. No need to specify the deployment ID or application name.

> *"Why did this fail?"*
> *"Show me recent deployments"*
> *"¿Qué pasó con este scope?"*

## See it in action

### Investigate a failed deployment

**Prompt**: *"Why did my deployment fail?"*

<details>
<summary>Assistant response</summary>

Let me investigate deployment #1847362 for your payment-service application.

**🔍 Current state**

| Field | Value |
|---|---|
| Application | payment-service |
| Environment | production |
| Build | #284 (commit a7f3d91) |
| Status | Failed |
| Duration | 5m 27s |

**🚨 Root cause analysis**

The deployment failed during the health check phase:

1. **Build & push**: ✅ Successful — image built and pushed to registry
2. **Container deployment**: ✅ Successful — container started on `prod-cluster-us-east-1`
3. **Health check**: ❌ Failed — `http://payment-service.internal:8080/health` timed out after 10 attempts

**📋 What I found**

The container started but couldn't respond to health checks because of a database connection failure:

```
FATAL: password authentication failed for user "payment_svc"
Connection to postgres-prod.internal:5432 refused
```

The `DATABASE_PASSWORD` parameter is missing from the deployment:

| Parameter | Status |
|---|---|
| `DATABASE_HOST` | ✅ Set |
| `DATABASE_USER` | ✅ Set |
| `DATABASE_PASSWORD` | ❌ Not configured |
| `DATABASE_NAME` | ✅ Set |

**💡 Timeline**

- **Apr 27, 10:15 UTC** — `DATABASE_PASSWORD` was removed from the production scope by `admin@company.com` during a credential rotation
- **Apr 27, 14:23 UTC** — your deployment started without the updated parameter

**✅ How to fix**

Add the missing parameter and redeploy:

```bash
# Set the parameter
np scope parameter create \
  --scope-id 3847291056 \
  --key "DATABASE_PASSWORD" \
  --value "your-secure-password" \
  --secret true

# Trigger a new deployment
np build deploy \
  --application-id 5739284610 \
  --build-id 284
```

</details>

### Build and deploy all applications

**Prompt**: *"Create a script that builds and deploys all my apps in the production namespace"*

<details>
<summary>Assistant response</summary>

```bash
#!/bin/bash
# Build and deploy all applications in production namespace
# Usage: ./deploy-all-apps.sh

set -e

NAMESPACE_ID="2847139502"

echo "🔍 Fetching applications..."
APPS=$(np application list --namespace_id "${NAMESPACE_ID}" --format json)

echo "$APPS" | jq -r '.[].id' | while read -r APP_ID; do
  APP_NAME=$(echo "$APPS" | jq -r ".[] | select(.id==$APP_ID) | .name")

  echo ""
  echo "🚀 Deploying ${APP_NAME}..."

  # Start build
  BUILD_ID=$(np build start --application_id "${APP_ID}" --format json | jq -r '.id')
  echo "   ⏳ Build ${BUILD_ID} in progress..."

  # Wait for completion
  while true; do
    STATUS=$(np build read --id "${BUILD_ID}" --format json | jq -r '.status')
    [ "$STATUS" == "success" ] && break
    [ "$STATUS" == "failed" ] && { echo "   ❌ Failed"; exit 1; }
    sleep 10
  done

  # Deploy
  np deployment create --body "{\"application_id\": ${APP_ID}, \"build_id\": ${BUILD_ID}}" > /dev/null
  echo "   ✅ Deployed successfully"
done

echo ""
echo "🎉 All applications deployed!"
```

</details>

Once you copy the script and run it, you'll see something like this:

```
🔍 Fetching applications...

🚀 Deploying api-gateway...
   ⏳ Build 7392841056 in progress...
   ✅ Deployed successfully

🚀 Deploying user-service...
   ⏳ Build 7392841057 in progress...
   ✅ Deployed successfully

🚀 Deploying payment-service...
   ⏳ Build 7392841058 in progress...
   ✅ Deployed successfully

🎉 All applications deployed!
```

### Service specification with PostgreSQL and Redis

**Prompt**: *"I need to add PostgreSQL and Redis to my application. Show me the service spec"*

<details>
<summary>Assistant response</summary>

Let me check what service specifications are already available.

**📋 Available service specifications**

| ID | Name | Type |
|---|---|---|
| `3f8a1d2e-7c4b-4e9f-a832-1d5e6f7a8b9c` | MySQL Database | dependency |
| `9b2c4e6d-1a3f-4d7e-b891-2c3d4e5f6a7b` | SQS Queue | dependency |

No PostgreSQL or Redis specifications found. Here are the commands to create them:

```bash
np service specification create --body '{
  "name": "PostgreSQL Database",
  "type": "dependency",
  "visible_to": ["organization=1234567890"],
  "use_default_actions": true,
  "selectors": {
    "category": "Database",
    "provider": "AWS",
    "sub_category": "Relational Database"
  },
  "attributes": {
    "schema": {
      "type": "object",
      "properties": {
        "version": { "type": "string", "default": "15" },
        "storage_gb": { "type": "number", "default": 20 },
        "instance_class": { "type": "string", "default": "db.t3.micro" }
      }
    },
    "values": {}
  }
}'
```

```bash
np service specification create --body '{
  "name": "Redis Cache",
  "type": "dependency",
  "visible_to": ["organization=1234567890"],
  "use_default_actions": true,
  "selectors": {
    "category": "Cache",
    "provider": "AWS",
    "sub_category": "In-Memory"
  },
  "attributes": {
    "schema": {
      "type": "object",
      "properties": {
        "version": { "type": "string", "default": "7.0" },
        "memory_gb": { "type": "number", "default": 2 },
        "node_type": { "type": "string", "default": "cache.t3.micro" }
      }
    },
    "values": {}
  }
}'
```


</details>

Once the specifications are created, go to your application in the nullplatform UI, open the **Services** tab, and click **Add service** to create an instance from each specification.

Nullplatform automatically injects these environment variables into your deployments once the service is provisioned:

- `POSTGRES_HOST`, `POSTGRES_PORT`, `POSTGRES_DATABASE`, `POSTGRES_USER`, `POSTGRES_PASSWORD`
- `REDIS_HOST`, `REDIS_PORT`


### Rollback to the previous deployment

**Prompt**: *"Create a script that rolls back my application to the previous deployment if the current one is failing"*

<details>
<summary>Assistant response</summary>

```bash
#!/bin/bash
# Rollback to previous deployment
# Usage: ./rollback.sh <application_id>

set -e

APP_ID="${1}"

if [ -z "$APP_ID" ]; then
  echo "Usage: $0 <application_id>"
  exit 1
fi

echo "🔍 Fetching deployment history..."

DEPLOYMENTS=$(np deployment list \
  --application_id "${APP_ID}" \
  --limit 2 \
  --format json)

CURRENT_ID=$(echo "$DEPLOYMENTS" | jq -r '.[0].id')
CURRENT_STATUS=$(echo "$DEPLOYMENTS" | jq -r '.[0].status')
PREVIOUS_BUILD=$(echo "$DEPLOYMENTS" | jq -r '.[1].build_id')

echo "📊 Current deployment: ${CURRENT_ID} (${CURRENT_STATUS})"

if [ "$CURRENT_STATUS" == "healthy" ]; then
  echo "✅ Current deployment is healthy. No rollback needed."
  exit 0
fi

echo "⚠️  Current deployment is ${CURRENT_STATUS}"
echo "🔄 Rolling back..."

NEW_DEPLOYMENT=$(np deployment create --body "{
  \"application_id\": ${APP_ID},
  \"build_id\": ${PREVIOUS_BUILD}
}" --format json)

NEW_ID=$(echo "$NEW_DEPLOYMENT" | jq -r '.id')
echo "✅ Rollback deployment created: ${NEW_ID}"
```
</details>

Once you copy the script and run it, you'll see something like this:

```
$ ./rollback.sh 5739284610

🔍 Fetching deployment history...
📊 Current deployment: 9374628510 (failed)

⚠️  Current deployment is failed
🔄 Rolling back...
✅ Rollback deployment created: 9374628587
```

### Summary

| Prompt | What the assistant generates |
|---|---|
| "Why did my deployment fail?" | Root cause analysis with timeline, logs, and a fix with ready-to-run CLI commands |
| "Build and deploy all apps" | Script that iterates applications and deploys each one |
| "PostgreSQL + Redis spec" | Service spec JSON and the `np service create` command |
| "Rollback script" | Script that reverts to the previous deployment if the current one is failing |

## Next steps

- [AI usage and quotas](/docs/ai/ai-usage): monitor token and session consumption for your organization and individual users
- [AI Ops](/docs/ai-ops/): overview of the AI Ops features in nullplatform, including workflows, checklists, Insights, and action items
