AI Platform Setup

Megabyte Island uses the Gradient AI platform to provision and host AI agents.


1. Generate an API token

  1. Log in to your AI Platform dashboard.
  2. Go to API → Personal Access Tokens → Generate New Token.
  3. Give it a descriptive name (e.g., gaas-provisioner).
  4. Select Read and Write scopes.
  5. Copy the token and add it to .env:
AI_PLATFORM_TOKEN=your-api-token-here

Principle of least privilege: This token has full account access. Rotate it regularly and revoke it immediately if compromised.


2. Gradient AI availability

Ensure your platform account has access to Gradient AI (GenAI Platform). As of early 2026 this requires being on a paid plan and may require allowlist approval in some regions.

Check availability:

curl -s -X GET $AI_PLATFORM_BASE_URL/gen-ai/agents 
  -H "Authorization: Bearer $AI_PLATFORM_TOKEN" | jq .

If you receive a 403 or 404, contact platform support to enable Gradient AI on your account.


3. Models used

Agent type Model ID Notes
WhatsApp llama3-70b-instruct Meta Llama 3 70B
Web Lead mistral-7b-instruct Mistral 7B
Brain llama3-70b-instruct Meta Llama 3 70B

These model IDs are defined in backend/src/services/provision-agent.ts in the AGENT_TEMPLATES map.


4. Knowledge base documents (Brain agents)

Before provisioning a Brain agent, upload documents to the platform:

  1. Platform Dashboard → Gradient AI → Knowledge Bases → Upload Document.
  2. Copy the Document ID (format: doc_...).
  3. Provide this ID in the onboarding form.

5. Provisioning flow

When provisionAgent() is called:

  1. POST /v2/gen-ai/agents — creates the agent with model + instruction.
  2. POST /v2/gen-ai/agents/:id/api-keys — creates a scoped API key.
  3. The raw key is AES-256-GCM encrypted and stored in the agents table.

If either DO API call fails, the error is logged to the server console and the subscription record is still written (so billing is not blocked). The agent status remains provisioning — an operator must manually retry or mark it as error.