Helm Chart (Agents API)

Deploy the PraisonAI agents API + Postgres to Kubernetes

Deploy the PraisonAI agents API together with a pgvector Postgres database to Kubernetes with the official Helm chart.

Diagram

Agents API Chart

📦 Helm Chart

⚙️ initContainer
generate api_server

🚀 API :8005

🗄️ Postgres

🌐 Service

🔗 Ingress

Quick Start

  1. Create the auth Secrets

    Pre-create the API token and Postgres password Secrets out-of-band.

    bash
    kubectl create secret generic praisonai-api-auth \
      --from-literal=PRAISONAI_API_TOKEN="$(openssl rand -hex 16)"
    kubectl create secret generic praisonai-postgres-auth \
      --from-literal=password="$(openssl rand -hex 16)"
  2. Install the chart

    Reference both Secrets so the chart’s fail-fast checks pass.

    bash
    helm install praisonai ./src/praisonai-deploy/infra/helm/praisonai-agents-api \
      --set auth.existingSecret=praisonai-api-auth \
      --set postgres.auth.existingSecret=praisonai-postgres-auth
  3. Verify with a port-forward

    Forward the Service and hit the health endpoint.

    bash
    kubectl port-forward svc/praisonai-praisonai-agents-api 8005:8005
    curl http://127.0.0.1:8005/health

How It Works

An initContainer generates the API server code from your agents.yaml, then the main container runs it against the in-cluster Postgres.

Diagram
PostgresAPI PodinitContainerKubernetesHelmPostgresAPI PodinitContainerKubernetesHelmRender objects (fail-fast on missing secrets)generate_api_server_code(agents.yaml)Write /work/api_server.pyConnect via DATABASE_URLGET /health (liveness/readiness)200 OK
ObjectCreatedPurpose
DeploymentalwaysinitContainer generates the server; main container serves the API on port 8005.
ServicealwaysExposes the API pod.
Ingresswhen ingress.enabled=trueExternal access.
StatefulSet + Service (Postgres)when postgres.enabled=trueIn-cluster pgvector database.
Secret (auth)when auth.token set (no existingSecret)Holds the API token.
Secret (postgres)when postgres.auth.password set (no existingSecret)Holds the DB password.
ConfigMap (agents)unless an existing ConfigMap is referencedMounts agents.yaml.
ServiceAccountwhen serviceAccount.create=truePod identity.

The initContainer receives PRAISONAI_AGENTS_FILE, PRAISONAI_API_PORT, and PRAISONAI_SERVER_FILE as env, then calls generate_api_server_code.


Configuration Options

Every key below is from src/praisonai-deploy/infra/helm/praisonai-agents-api/values.yaml.

Chart identity: version: 0.1.0, appVersion: "latest".

KeyTypeDefaultDescription
replicaCountint1API replicas.
image.repositorystringghcr.io/mervinpraison/praisonaiOfficial GHCR image.
image.tagstring"" (falls back to appVersion)Pin a released tag in production.
image.pullPolicystringIfNotPresentImage pull policy.
imagePullSecretslist[]Pull secrets for private registries.
agents.fileNamestringagents.yamlMounted agents file name.
agents.contentstring(sample assistant)Inline agents YAML.
agents.configMapNamestring""Use a named ConfigMap the chart creates.
agents.existingConfigMapstring""Reference a pre-existing ConfigMap.
api.portint8005Container port.
api.serverFilestringapi_server.pyGenerated server entrypoint.
auth.enabledbooltrueInject PRAISONAI_API_TOKEN.
auth.existingSecretstring""Reference a pre-created Secret (preferred).
auth.secretKeystringPRAISONAI_API_TOKENData key in the Secret to read.
auth.tokenstring""Inline token; chart creates a Secret. Avoid in Git.
postgres.enabledbooltrueDeploy an in-cluster pgvector Postgres.
postgres.imagestringpgvector/pgvector:pg16Postgres image.
postgres.portint5432Postgres port.
postgres.databasestringpraisonaiDatabase name.
postgres.usernamestringpraisonaiDatabase user.
postgres.auth.existingSecretstring""Reference a pre-created password Secret.
postgres.auth.passwordstring""Inline password; chart creates a Secret. Avoid in Git.
postgres.auth.secretKeystringpasswordData key in the Secret to read.
postgres.persistence.enabledbooltruePersist the database on a PVC.
postgres.persistence.sizestring8GiPVC size.
postgres.persistence.storageClassstring""PVC storage class.
service.typestringClusterIPService type.
service.portint8005Service port.
ingress.enabledboolfalseExpose via Ingress.
ingress.classNamestringnginxIngressClass name.
ingress.annotationsmap{}Ingress annotations.
ingress.hostslist[{host: api.example.com, paths: [{path: /, pathType: Prefix}]}]Ingress hosts and paths.
ingress.tlslist[]Ingress TLS blocks.
probes.enabledbooltrueEnable liveness/readiness probes.
probes.pathstring/healthProbe path.
envlist[]Extra env vars (e.g. LLM keys via secretKeyRef).
resourcesmap{}Resource requests/limits.
serviceAccount.createbooltrueCreate a ServiceAccount.
serviceAccount.namestring""Override the ServiceAccount name.
podAnnotationsmap{}Pod annotations.
podSecurityContextmap{}Pod-level securityContext.
securityContextmap{}Container-level securityContext.
nodeSelectormap{}Pod nodeSelector.
tolerationslist[]Pod tolerations.
affinitymap{}Pod affinity.

Security — Fail-Fast on Missing Secrets

The chart refuses to render without a token source and a database password.

Fix each by pre-creating the referenced Secret (preferred) or supplying the inline value. Disable a subsystem’s requirement only for trusted local testing by setting auth.enabled=false or postgres.enabled=false.


Passing LLM Keys via env

Pass provider keys with the valueFrom.secretKeyRef pattern.

yaml
env:
  - name: OPENAI_API_KEY
    valueFrom:
      secretKeyRef:
        name: praisonai-llm
        key: OPENAI_API_KEY

Best Practices

Prefer existingSecret over inline values

Inline auth.token and postgres.auth.password end up in Git. Pre-create Secrets and reference them with existingSecret.

Pin image.tag in production

The default tag falls back to appVersion (latest), which drifts. Pin a released tag for reproducible deployments.

Keep persistence enabled for real data

postgres.persistence.enabled=true binds an 8Gi PVC by default. Size it for your workload and set a storageClass where needed.

Set resources requests/limits

The chart ships resources: {}, so the pod has no guaranteed CPU/memory. Set requests and limits before production.


Install via the CLI

Skip the long helm invocation — the CLI wrapper injects both Secret references for you.

bash
praisonai deploy helm --chart agents-api

Related