Only this pageAll pages
Powered by GitBook
1 of 53

Products

Loading...

Backend Capsule

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Database Capsule

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Frontend capsule

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Storage Capsule

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Wordpress Capsule

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Agent Capsule

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Enterprise Clusters

Loading...

Alerting

Manage your notification preferences to stay informed about the health and performance of your Capsules.

Notification Settings

In-App Notifications

Configure which alerts you want to receive within the Code Capsules platform. Toggle individual notification types on or off based on your monitoring needs.

Email Notifications

Set up email alerts to receive notifications outside the platform. You can enable or disable email notifications for the same events as in-app notifications.

Notification Types

Available notification types include:

  • Capsule Not Running: When a Capsule crashes or stops running.

  • Killed by OOM: When a Capsule runs out of memory.

  • High CPU Usage: When CPU usage exceeds 80%.

  • High Memory Usage: When memory usage exceeds 80%.

Use the Enable All or Disable All buttons to quickly configure all notifications.

Click Save Preferences to apply your changes.

Scale

You can allocate more resources to a Capsule as your application's traffic and computational needs change.

View the scaling options available for your Capsule in the Scale tab of the Capsule dashboard. To adjust the allocated resources, click Edit in the Capsule Capacity section.

Scale a Capsule

Use the sliders to configure the Capsule's resources, then click Save.

Configure Capsule Capacity

Alerting

Manage your notification preferences to stay informed about your Capsule's health and performance.

Notification Settings

In-App Notifications

Configure which alerts you want to receive within the Code Capsules platform. Toggle individual notification types on or off based on your monitoring needs.

Email Notifications

Set up email alerts to receive notifications outside the platform. You can enable or disable email notifications for the same events as in-app notifications.

Notification Types

Available notification types include:

  • Capsule Not Running - Alert when your capsule crashes or stops

  • Killed by OOM - Notify when your capsule runs out of memory

  • High CPU Usage - Alert when CPU usage exceeds 80%

  • High Memory Usage - Notify when memory usage exceeds 80%

Use "Enable All" or "Disable All" buttons to quickly configure all notifications, then click "Save Preferences" to apply your changes.

Build and Deploy

Python

Popular Languages and Frameworks

Docker

Deployment Guides

Alerting

Manage your notification preferences to stay informed about your Capsule's health and performance.

Notification Settings

In-App Notifications

Configure which alerts you want to receive within the Code Capsules platform. Toggle individual notification types on or off based on your monitoring needs.

Email Notifications

Set up email alerts to receive notifications outside the platform. You can enable or disable email notifications for the same events as in-app notifications.

Notification Types

Available notification types include:

  • Capsule Not Running - Alert when your capsule crashes or stops

  • Killed by OOM - Notify when your capsule runs out of memory

  • High CPU Usage - Alert when CPU usage exceeds 80%

  • High Memory Usage - Notify when memory usage exceeds 80%

Use "Enable All" or "Disable All" buttons to quickly configure all notifications, then click "Save Preferences" to apply your changes.

Deploy

MySQL

MongoDB

Products

Everything you need to know about configuring and deploying apps with Code Capsules.

This section contains all the information you need to deploy, configure, and manage applications using different Capsule types on Code Capsules.

Capsule Types

Configure

Configure a Database Capsule in the Details tab of the Capsule dashboard.

View Connection Details

The Details tab provides connection details for a Database Capsule.

Click show in the Connection Details section to view database credentials:

Backups

Protect your data by creating manual backups and setting up automatic backup schedules for your Data Capsules.

Manual Backup

Trigger a manual backup of your Capsule by clicking the Backup button in the Manual Backup section.

Configure

Configure a Backend Capsule in the Config tab.

Set Capsule Parameters

Click Edit in the Capsule Parameters section to set the Capsule's project path, network port, and run command.

Scale

It is possible to allocate more resources to your Capsule depending on how much traffic your application will be getting and its computational needs. To view the different scaling options available for your Capsule, navigate to the "Scale" tab while on your Capsule's dashboard, and click the "Edit" button in the "Capsule Capacity" section.

Change the allocated resource for the Capsule with the sliders. Click "Save" when done.

Configure

To configure your Persistent Storage Capsule, navigate to the "Details" tab.

Edit Capsule Name

Click "Edit" in the "Capsule Details" section to rename your Persistent Storage Capsule.

Logs

View your Capsule's logs to monitor activity and debug issues.

View Capsule Logs

Navigate to the "Logs" tab to view your Capsule's system logs.

Logs

Use Capsule logs to monitor activity and debug issues.

View Capsule Logs

View a Capsule's system logs in the Logs tab.

Scale

It is possible to allocate more resources to your Capsule depending on how much traffic your application will be getting and its computational needs. To view the different scaling options available for your Capsule, navigate to the "Scale" tab while on your Capsule's dashboard, and click the "Edit" button in the "Capsule Capacity" section.

Change the allocated resource for the Capsule with the sliders. Click "Save" when done.

How State Works

A Capsule can write to a local file system, but those files will not persist after the Capsule is restarted.

A Capsule can be thought of as a computational process that can be started and restarted. When a Capsule is started, it receives a fresh copy of the code from a GitHub repository. You can write to a Capsule in a local file system, but that file system will also start afresh when the code restarts and pulls from the GitHub repository again, so any files written to that file system will not persist when the Capsule is restarted automatically.

Instead, to have the data persist, we recommend using an external database.

Take a look at our guide to for more information.

setting up file persistence with a Data Capsule
Automatic Backups

Toggle the switch next to the backup schedule you want to use:

  • Daily Backup: Creates backups every day

  • Weekly Backup: Creates backups every week

  • Monthly Backup: Creates backups every month

Code Capsules retains backups based on your selected schedule and automatically deletes older backups as new ones are created.

View Backups

The Backups section in the right-hand panel lists all completed backups. You can restore and manage backup files here.

Backup storage costs $0.50/GB.

Backups Configuration
Project Path

The Project Path specifies the path to your code. The default is /, which works for most projects.

Network Port

The Network Port is the port your app runs on. Your app must be configured to listen on this port. The default is 3000.

Run Command

Use the Run Command field to specify how to start your app. Leave this field empty to use the default command for the Capsule type, or enter a custom command:

  • Python: python app.py

  • Node.js: npm start

  • Ruby: ruby app.rb

Set Environment Variables

Each Backend Capsule is automatically assigned an APP_URL environment variable that stores its public URL.

To view environment variable values, click show in the top-right corner of the table.

To add or edit custom variables:

  1. Click Key/Val Editor or Text Editor in the top-right corner.

  2. Enter or update the variable’s Name and Value.

  3. Click Save to apply your changes.

Connect Data Capsules

Connect a Database Capsule

In the Data capsules section, click the View button next to a Database Capsule to see its connection details.

Click + next to the Connection string variable to create a DATABASE_URL environment variable in your Backend Capsule. Your application will use this variable to connect to and use the services provided by the Database Capsule.

Connect a Persistent Storage Capsule

Click Bind next to the Persistent Storage Capsule to attach it to your Backend Capsule.

During the bind process, Code Capsules creates a PERSISTENT_STORAGE_DIR environment variable that tells your Backend Capsule where to access the Persistent Storage Capsule.

Configure Backend Capsule
Scale a Capsule
Configure Capsule Capacity
Capsule Logs
Scale a Capsule
Configure Capsule Capacity

High Data Usage: When data usage exceeds 80%.

  • CPU Throttle: When CPU is being throttled.

  • High Data Usage - Alert when data usage exceeds 80%

  • CPU Throttle - Notify when CPU is being throttled

  • High Data Usage - Alert when data usage exceeds 80%

  • CPU Throttle - Notify when CPU is being throttled

  • Monitor

    Each Capsule tracks its usage data and you can view this information by opening the "Metrics" tab on your Capsule's page.

    Other Databases

    Deployment Guides

    Django + MySQL

    Flask + MySQL

    Java + MySQL

    Django + MongoDB

    Express + MongoDB

    Flask + MongoDB

    Deployment Guides

    Backend Capsule

    Host and scale server-side applications and APIs.

    Frontend Capsule

    Serve static and single-page web apps with CDN support.

    Database Capsule

    Managed database instances: MySQL, PostgreSQL, MongoDB, Redis.

    Memory Capsule

    Fast in-memory data stores for caching and real-time workloads.

    Storage Capsule

    Object storage for files, assets, and backups.

    WordPress Capsule

    Optimized environment for WordPress sites.

    Host

  • Port

  • Database name

  • Username

  • Password

  • Connection string

  • Edit Capsule Name

    To change the name of the Capsule, click Edit next to the Capsule name in the Capsule Details section.

    Enable Public Access

    The Public Access feature is currently available for MongoDB Capsules.

    Toggle on Public Access to allow access to the database from outside your Space.

    When Public Access is toggled on, Code Capsules generates a public connection string that you can use to connect to the database.

    MongoDB Public Access

    Configure MySQL Settings

    These settings are only available for MySQL Capsules.

    Additional MySQL configuration is available in the Config tab of MySQL Capsules.

    MySQL Configuration

    Set SQL Modes

    In the MySQL Configuration section, click Edit to select SQL modes for your MySQL server.

    SQL modes determine how MySQL handles queries and data validation. Common options include:

    • STRICT_TRANS_TABLES - Enables strict mode for transactional tables

    • NO_ZERO_DATE - Prevents the use of invalid date values

    • ONLY_FULL_GROUP_BY - Requires GROUP BY to list all selected columns

    Database Connection Details
    Enable Public Access

    Toggle "Public Access" in the "Public Access" section to allow connections from outside your Space.

    This is disabled by default for security.

    Connect to WebDAV

    When Public Access is enabled, you can connect to your storage using WebDAV.

    Connect to Public Storage with WebDAV

    View Connection Information

    Click "show" in the "WebDAV Connection Information" section to view:

    • WebDAV Server URL

    • Username

    • Password

    Connect from Mac

    1. Open Finder

    2. Click on "Go" in the menu bar and select "Connect to Server"

    3. Enter the WebDAV server URL in the following format: https://server-address

    4. Click "Connect"

    5. Enter the username and password when prompted

    6. The WebDAV server will now appear as a mounted drive in Finder

    Connect from Windows

    1. Open File Explorer

    2. Right click on "This PC" in the sidebar

    3. Click on "Add a network location"

    4. Click "Next" in the wizard until prompted to enter the "Internet or network address"

    5. Enter the WebDAV server URL in the following format: https://server-address

    6. Enter the username and password when prompted

    7. Complete the setup wizard

    8. The WebDAV server will now appear as a mapped drive in File Explorer

    Connect from Linux

    1. Open your file manager (e.g., Nautilus, Dolphin, Thunar)

    2. In your address bar enter the WebDAV server URL in the following format:

      • davs://server-address for Nautilus and Thunar

      • webdavs://@server-address for Dolphin

    3. Enter the username and password when prompted

    4. The WebDAV server will now appear as a mounted drive in your file manager

    Configure Persistent Storage Capsule
    View Access Logs

    For Capsules that serve web traffic, open the Access Logs tab to view HTTP request logs.

    Access Logs Tab
    Logs Tab

    Python

    Django

    Flask

    Express.js

    Java

    Go

    Caddy Docker Site

    Docker Laravel App

    Docker PHP App

    Flask Docker App

    Backend Deployment Guides

    Alerting

    Manage your notification preferences to stay informed about your Capsule's health and performance.

    Notification Settings

    In-App Notifications

    Configure which alerts you want to receive within the Code Capsules platform. Toggle individual notification types on or off based on your monitoring needs.

    Email Notifications

    Set up email alerts to receive notifications outside the platform. You can enable or disable email notifications for the same events as in-app notifications.

    Notification Types

    Available notification types include:

    • Capsule Not Running - Alert when your capsule crashes or stops

    • Killed by OOM - Notify when your capsule runs out of memory

    • High CPU Usage - Alert when CPU usage exceeds 80%

    • High Memory Usage - Notify when memory usage exceeds 80%

    Use "Enable All" or "Disable All" buttons to quickly configure all notifications, then click "Save Preferences" to apply your changes.

    Scale

    It is possible to allocate more resources to your Capsule depending on how much traffic your application will be getting and its computational needs. To view the different scaling options available for your Capsule, navigate to the "Scale" tab while on your Capsule's dashboard, and click the "Edit" button in the "Capsule Capacity" section.

    Scale a Capsule

    Change the allocated resource for the Capsule with the sliders. Click "Save" when done.

    Configure Capsule Capacity

    Alerting

    Manage your notification preferences to stay informed about your Capsule's health and performance.

    Notification Settings

    In-App Notifications

    Configure which alerts you want to receive within the Code Capsules platform. Toggle individual notification types on or off based on your monitoring needs.

    Email Notifications

    Set up email alerts to receive notifications outside the platform. You can enable or disable email notifications for the same events as in-app notifications.

    Notification Types

    Available notification types include:

    • Capsule Not Running - Alert when your capsule crashes or stops

    • Killed by OOM - Notify when your capsule runs out of memory

    • High CPU Usage - Alert when CPU usage exceeds 80%

    • High Memory Usage - Notify when memory usage exceeds 80%

    Use "Enable All" or "Disable All" buttons to quickly configure all notifications, then click "Save Preferences" to apply your changes.

    Logs

    Use Capsule logs to monitor activity and debug issues.

    View Capsule Logs

    View a Capsule's system logs in the Logs tab.

    Capsule Logs

    View Access Logs

    For Capsules that serve web traffic, open the Access Logs tab to view HTTP request logs.

    Monitor

    Each Capsule tracks its usage data and you can view this information by opening the "Metrics" tab on your Capsule's page.

    Monitor Capsule Metrics

    Monitor

    Each Capsule tracks its usage data. View this information by opening the Metrics tab on the Capsule's page.

    Monitor Capsule Metrics

    Agent API (Sample)

    The following specifications describe a standard API used by the Code Capsules chat window to communicate with the agent.

    Schemas

    Logs

    View your Capsule's logs to monitor activity and debug issues.

    View Capsule Logs

    Navigate to the "Logs" tab to view your Capsule's system logs.

    Monitor

    Each Capsule tracks its usage data and you can view this information by opening the "Metrics" tab on your Capsule's page.

    Configure

    To configure your Wordpress Capsule, navigate to the "Config" tab.

    Choose a MySQL Capsule

    Your WordPress Capsule needs to connect to a MySQL Data Capsule. Click "Edit" in the "Wordpress Config" section to select a MySQL Capsules from your Space.

    Scale

    You can allocate more resources to a Capsule as your application's traffic and computational needs change.

    View the scaling options available for your Capsule in the Scale tab of the Capsule dashboard. To adjust the allocated resources, click Edit in the Capsule Capacity section.

    Use the sliders to configure the Capsule's resources, then click Save.

    Configure

    To configure your Frontend Capsule, navigate to the "Config" tab.

    Set the Project Path

    Click "Edit" in the "Capsule Parameters" section to set where your HTML files are located. The default is / which works for most projects.

    Alerting

    Manage your notification preferences to stay informed about your Capsule's health and performance.

    In-App Notifications

    Configure which alerts you want to receive within the Code Capsules platform. Toggle individual notification types on or off based on your monitoring needs.

    Logs

    View your Capsule's logs to monitor activity and debug issues.

    View Capsule Logs

    Navigate to the "Logs" tab to view your Capsule's system logs.

    Monitor Capsule Metrics
    Edit the Database Name

    Click "Edit" in the "Wordpress Config" section to edit the name of your WordPress database. The default is app.

    Choose a Storage Capsule

    Your WordPress Capsule needs to connect to a Peristent Storage Capsule. Click "Edit" in the "Wordpress Config" section to select a Peristent Storage Capsule from your Space.

    Environment Variables

    WordPress Capsules automatically get these environment variables:

    • WORDPRESS_DB_HOST - Database server location

    • WORDPRESS_DB_NAME - Database name

    • WORDPRESS_DB_USER - Database username

    • WORDPRESS_DB_PASSWORD - Database password

    • APP_URL - Your site's public URL

    To view variable values, click "show" in the "Environment Variables" section.

    To add custom variables:

    1. Click "Key/Val Editor" or "Text Editor" in the "Environment Variables" section

    2. Edit the variable "Name" and "Value"

    3. Click "Save"

    Custom php.ini Config

    Add custom PHP settings if needed, like upload sizes or memory limits.

    Leave the field empty to use default settings.

    Configure Wordpress Capsule
    Scale Tab
    Edit Scale
    Set the Build Command

    Click "Edit" in the "Capsule Parameters" section to set your build command. The default is Auto which automatically detects and runs your build process.

    Set the Build Output Directory

    Click "Edit" in the "Capsule Parameters" section to set where your built files end up. Leave as / if you're not using a build process.

    Environment Variables

    Frontend Capsules automatically get these environment variables:

    • APP_URL - Your capsule's public URL

    To view variable values, click "show" in the "Environment Variables" section.

    To add custom variables:

    1. Click "Key/Val Editor" or "Text Editor" in the "Environment Variables" section

    2. Edit the variable "Name" and "Value"

    3. Click "Save"

    Configure Frontend Capsule
    Email Notifications

    Set up email alerts to receive notifications outside the platform. You can enable or disable email notifications for the same events as in-app notifications.

    Notification Types

    Available notification types include:

    • Capsule Not Running - Alert when your capsule crashes or stops

    • Killed by OOM - Notify when your capsule runs out of memory

    • High CPU Usage - Alert when CPU usage exceeds 80%

    • High Memory Usage - Notify when memory usage exceeds 80%

    • High Data Usage - Alert when data usage exceeds 80%

    • CPU Throttle - Notify when CPU is being throttled

    Use "Enable All" or "Disable All" buttons to quickly configure all notifications, then click "Save Preferences" to apply your changes.

    Notification Settings

    High Data Usage - Alert when data usage exceeds 80%

  • CPU Throttle - Notify when CPU is being throttled

  • High Data Usage - Alert when data usage exceeds 80%

  • CPU Throttle - Notify when CPU is being throttled

  • Access Logs

    Scale

    It is possible to allocate more resources to your Capsule depending on how much traffic your application will be getting and its computational needs. To view the different scaling options available for your Capsule, navigate to the "Scale" tab while on your Capsule's dashboard, and click the "Edit" button in the "Capsule Capacity" section.

    Change the allocated resource for the Capsule with the sliders. Click "Save" when done.

    Overview

    Coming Soon

    View Access Logs

    For Capsules that serve web traffic, navigate to the "Access Logs" tab to view HTTP request logs.

    Access Logs
    Capsule Logs
    View Access Logs

    For Capsules that serve web traffic, navigate to the "Access Logs" tab to view HTTP request logs.

    Access Logs
    Capsule Logs

    Postgres

    Redis

    Database Deployment Guides

    WordPress Site

    Quickstart guide to running WordPress on a dedicated Capsule.

    Deploy

    Deploy a WordPress application and learn how to host a content management system on Code Capsules.

    Set up

    To follow this guide, you'll need a Code Capsules account. WordPress can be downloaded and deployed automatically or you can connect your Capsule to Wordpress hosted on a GitHub repository.

    Create an Account with Code Capsules

    Before creating your WordPress capsule, you'll need a Team and a Space. You can follow these guides to learn how to create and .

    If you already have a Team and Space set up, log in to your Code Capsules account. On the dashboard, click the yellow + on the bottom left of the screen then click "New Capsule".

    Create the Capsule

    A provides the server for hosting an application on Code Capsules.

    To create a Wordpress Capsule first choose "WordPress" as the Capsule type, as well as your Team, and Space.

    Next choose your payment plan, or create a custom plan.

    A Wordpress Capsule requires a connection to a MySQL Database Capsule as well as a Persistent Storage Capsule. Either select a previosuly created instance of each from the dropdowns, or click the yellow + next to each and follow the prompts for creating each Capsule. Click "Create Capsule".

    Choose How to Deploy

    Default Deployment

    To automatically download and deploy a Wordpress version on Code Capsules:

    1. Select the "Default" deployment type from the dropdown

    2. Choose your WordPress version

    3. Click "Next"

    Git Managed

    To deploy WordPress from your version control repository:

    1. Select the "Git Managed" deployment type

    2. Select a repository

    3. Select the branch to deploy from

    4. Click "Next"

    You can read more about connecting your account to a version control provider in .

    Monitor Deployment

    Code Capsules will automatically build and deploy your WordPress application. You can view the build log by selecting the "Logs" tab to monitor the deployment progress.

    Once the build is complete, click the URL link in the "Details" tab, to access your WordPress site.

    Set Up WordPress

    When you first visit your WordPress site, you'll see the installation screen:

    1. Enter your site title.

    2. Create an admin username.

    3. Set a strong password.

    4. Provide your email address.

    After installation, you'll see the WordPress admin dashboard and can begin customizing your site.

    Configure

    Configure an Agent Capsule in the Config tab.

    Agent Config Tab

    Set Capsule Parameters

    Click Edit in the Capsule Parameters section to set the Capsule's project path, network port, and run command.

    Project Path

    The Project Path specifies the path to your code. The default is /, which works for most projects.

    Network Port

    The Network Port is the port your app runs on. Your app must be configured to listen on this port. The default is 3000.

    Run Command

    Use the Run Command field to specify how to start your app. Leave this field empty to use the default command for the Capsule type, or enter a custom command:

    • Python: python app.py

    • Node.js: npm start

    If using a , the production ready command is npm run start:prod by default.

    Set Agent Config

    Click Edit in the Agent Config section to set the Capsule's provider, model, and API key.

    Provider

    The Provider specifies the public AI provider to use for the capsule. This will expose a PROVIDER_NAME environment variable in the runtime of the capsule. Among a few pre-defined options, there is also the ability to set a Custom provider name, which your altered codebase will need to cater for.

    Model

    The Model specifies the AI model to be used during the agent runtime. This will expose a PROVIDER_MODEL environment variable in the runtime of the capsule. Among a few pre-defined options per provider, there is also the ability to set a Custom model name, which your altered codebase will need to cater for.

    API Key

    The API Key specified the key as provided by the AI Provider. This is issued outside of Code Capsules but are necessary for the agent to work, and will expose a PROVIDER_API_KEY environment variable in the runtime of the capsule.

    Set Environment Variables

    Each Agent Capsule is automatically assigned an APP_URL environment variable that stores its public URL.

    To view environment variable values, click show in the top-right corner of the table.

    To add or edit custom variables:

    1. Click Key/Val Editor or Text Editor in the top-right corner.

    2. Enter or update the variable’s Name and Value.

    3. Click Save to apply your changes.

    Connect Data Capsules

    Connect a Database Capsule

    In the Data capsules section, click the View button next to a Database Capsule to see its connection details.

    Click + next to the Connection string variable to create a DATABASE_URL environment variable in your Agent Capsule. Your application will use this variable to connect to and use the services provided by the Database Capsule.

    Connect a Persistent Storage Capsule

    Click Bind next to the Persistent Storage Capsule to attach it to your Agent Capsule.

    During the bind process, Code Capsules creates a PERSISTENT_STORAGE_DIR environment variable that tells your Agent Capsule where to access the Persistent Storage Capsule.

    Monitor

    Each Capsule tracks its usage data. View this information by opening the Metrics tab on the Capsule's page.

    Monitor Tab

    Deploy

    Deploy a configurable Agent Capsule on Code Capsules.

    Set up

    To follow this guide, you'll need a Code Capsules account.

    Create an Account with Code Capsules

    Before creating your Agent Capsule, you'll need a Team and a Space. You can follow these guides to learn how to create and .

    If you already have a Team and Space set up, log in to your Code Capsules account. On the dashboard, click the yellow + on the bottom left of the screen then click "New Capsule".

    Create the Capsule

    A provides the server for hosting an application on Code Capsules.

    To create an Agent Capsule first choose "AI Agent" as the Capsule type, as well as your Team, and Space.

    Next choose your payment plan, or create a custom plan.

    Code Capsules provides templates (see ) as a baseline for creating your AI Agent. When creating the Agent Capsule, you can select if your codebase comes from a template repo. In this case, you will be asked to enter a provider, model, and API key for a public AI provider, such as Google Gemini or Anthropic. When registering with one of these providers, they should provide an API key to access their public API's. Once the capsule is created, the templates will make use of this information via environment variables, which are automatically set up for you upon capsule creation. You can learn more about how these templates make use of these environment variables .

    Monitor Deployment

    Code Capsules will automatically build and deploy your Agent Capsule. You can view the build log by selecting the "Build logs" tab to monitor the deployment progress.

    Once the build is complete, use the Chat tab to interface with your newly running agent.

    Monitor

    Each Capsule tracks its usage data and you can view this information by opening the "Metrics" tab on your Capsule's page.

    Monitor Capsule Metrics

    Deploy

    JavaScript Frameworks

    Modern Frontend Technologies

    Static Sites

    Deployment Guides

    Migrations

    This guide walks you through migrating a database using an Express app and a MySQL Capsule.

    You might find our guides on and helpful.

    Step 1: Clone From Your GitHub Repository

    To install db-migrate, first clone your GitHub repository with the following command (make sure to replace the username and repository name with your own):

    git clone https://github.com/git_username/repository_name.git

    Logs

    View your Capsule's logs to monitor activity and debug issues.

    View Capsule Logs

    Navigate to the "Logs" tab to view your Capsule's system logs.

    Teams
    Spaces
    Capsule
    Templates
    here
    Create Agent Capsule
    Create Agent Capsule
    Choose Plan
    Template Setup
    Build Logs
    Chat Tab
    Code Capsules Agent Template
    Click "Install WordPress".
    this guide
    Step 2: Install db-migrate

    To use migration commands, install both db-migrate and db-migrate-mysql with the following commands:

    npm install -g db-migratenpm i db-migrate-mysql

    Step 3: Connect to the Database With database.json

    The db-migrate package connects to a database through a database.json file.

    Create a file called database.json in your root directory and populate it with your database information. The example below shows how to connect to both a local database called "dev" and a MySQL Data Capsule called "prod" (be sure to replace the database information with your own):

    Here we also add"sql-file": true to ensure that database migrations run using SQL files, which we'll create in the next step.

    Find the database URL for a MySQL Data Capsule in the Config tab of a Backend Capsule:

    You can also access the database URL using an environment variable as follows:

    "prod": {"ENV":"DATABASE_URL"},

    Step 4: Create and Populate SQL Files

    Run the following command to create a folder to store migrations:

    db-migrate create insert_unique_name --sql-file

    The folder should contain three files:

    MySQL queries are stored in the two generated SQL files: One named with an up suffix and the other with a down suffix.

    Down-Migration Query

    Insert the following SQL query into the down file to remove a row from the database:

    Up-Migration Query

    Insert the following SQL query into the up file to insert a row into the database:

    Add your own MySQL queries to these SQL files to define custom database migrations.

    Step 5: Update Scripts

    In the root directory of the project, update the "scripts" section in the package.json file as follows:

    Modify these scripts to suit your developer and production environments.

    The migration scripts shown here are designed to be used on Code Capsules or in a developer environment.

    Step 6: Edit the Run Command

    To run these migrations in a production environment, update the Capsule's Run Command to execute the migration scripts.

    Edit the Run Command in the Config tab of the Backend Capsule.

    Step 7: Push the Changes

    Finally, commit and push your changes to your GitHub repository to update the codebase and trigger the migrations.

    View migration activity in the Backend Capsule's Logs tab. The output will look similar to this:

    View Access Logs

    For Capsules that serve web traffic, navigate to the "Access Logs" tab to view HTTP request logs.

    Access Logs
    Capsule Logs

    React

    Angular

    Vue

    Next.js

    Svelte

    Static HTML

    HTML5UP Template

    Bootstrap

    Frontend Deployment Guides

    Deploy

    You need persistent storage for your application, but you don't want a full-blown database.

    This guide will show you how to create a persistent storage Data Capsule that you can use with backend applications running on Code Capsules.

    What is a Persistent Storage Capsule?

    A Persistent Storage Capsule works like a virtual hard drive in the cloud. The key benefit is that you can attach multiple Backend or Docker Capsules to the same Persistent Storage Capsule, enabling them to share data and scale horizontally or vertically.

    How To Set Up Persistent File Storage

    To set up persistent file storage, you'll first create a Persistent Storage Capsule, then bind it to a Backend Capsule.

    Create a File Storage Capsule

    Log in to your Code Capsules account and navigate to the Space where you want to create a Data Capsule.

    Click the yellow + button on the bottom-left corner of the dashboard. Select New Capsule and then Persistent Storage from the dropdown.

    Select your payment method, then click Create Capsule.

    Bind the Storage Capsule to a Backend Capsule

    You need to bind the Storage Capsule to a Backend Capsule hosted on Code Capsules before you can connect to and use it.

    Navigate to the Backend Capsule and open the Config tab. Scroll down to the Bind Data Capsule section, where your recently created Storage Capsule is listed.

    Click Bind to bind the Capsules.

    During the bind process, Code Capsules creates a PERSISTENT_STORAGE_DIR environment variable that your Backend Capsule will use to access the Storage Capsule.

    When the two Capsules are bound, scroll to the top of the Config tab to view the value of the variable.

    Now you can use this environment variable in your code to read and write to the Storage Capsule. Copy the value of the PERSISTENT_STORAGE_DIR variable and assign it to the db_directory variable. Alternatively, reference it directly using os.getenv in Python or process.env in Node.js.

    Connect to a Storage Capsule From a Python Application

    If you're using Python in your Backend Capsule, use the following code to connect to the Storage Capsule:

    Connect to a File Data Capsule From a Node.js Application

    If you're using Node.js in your Backend Capsule, use the following code to connect to the Storage Capsule:

    Access Files Using WebDAV

    By default, you can't browse files and folders in your Persistent Storage Capsule without building your own file browser. To solve this, Code Capsules provides native WebDAV access.

    To enable file browsing:

    1. Navigate to your Persistent Storage Capsule

    2. Go to the Details tab

    3. Toggle Public Access to Enabled

    Enabling this setting doesn't make your files publicly accessible on the internet. They are served over the WebDAV protocol and require authentication credentials to access.

    Connect to the WebDAV Server

    macOS

    1. Open Finder

    2. Click on Go in the menu bar and select Connect to Server

    3. Enter the WebDAV server URL in the following format: https://server-address

    4. Click Connect

    The WebDAV server will now appear as a mounted drive in Finder.

    Here you can see the files inside a WordPress Capsule accessed locally through Finder in macOS.

    Windows

    1. Open File Explorer

    2. Right click on This PC in the sidebar

    3. Click Add a network location

    4. Click Next in the wizard until prompted to enter the Internet or network address

    The WebDAV server will now appear as a mapped drive in File Explorer.

    Linux

    1. Open your file manager (for example, Nautilus, Dolphin, or Thunar)

    2. In your address bar, enter the WebDAV server URL in the following format:

      • davs://server-address for Nautilus and Thunar

      • webdavs://@server-address

    The WebDAV server will now appear as a drive in your file manager.

    Chat

    Code Capsules provides an integrated chat window for Agent Capsules. In order for this to be fully functional, there are a few endpoints which the API needs to expose.

    API Requirements

    The deployed codebase needs to expose a few endpoints, each with their own pre-described payload. Data is always returned in the ApiResponse format. Errors are returned in the Error format.

    Endpoints

    Below describes the endpoints required to use the integrated chat window:

    Endpoint
    Purpose
    Mandatory
    Sample Docs

    *Only one of these are required

    Request Headers from Code Capsules

    All of the above endpoints will also be passed the following headers. This allows for some simple security when testing the agent using the integrated chat window:

    Header
    Description
    Mandatory

    Add a Procfile to a Backend Application

    A Procfile tells the Backend Capsule which processes to run and how to start them. While Procfiles aren't required on Code Capsules, you can provide one to define custom startup behavior for your application.

    Instead of using a Procfile, you can specify build and run commands directly in the Code Capsules UI. For example, the screenshot below shows how to enter a run command for a Node.js application.

    Procfile Naming and Location

    A Procfile is a plain text file. It must be named exactly Procfile, with no extensions (like .txt

      "dev": {
        "driver": "mysql",
        "user": "root",
        "database": "database_name",
        "password": "my_password"
      },
      "prod": "Insert Your Database URL here",
      "sql-file": true
    }
    ALTER TABLE table_name 
    DROP COLUMN drop_column_name; 
    ALTER TABLE table_name
    ADD new_row_name datatype;
    "scripts": {
        "start": "node ./bin/www",
        "migratedev": "node node_modules/db-migrate/bin/db-migrate up -e dev",
        "migrate-prod-up": "node node_modules/db-migrate/bin/db-migrate up -e prod",
        "migrate-prod-down": "node node_modules/db-migrate/bin/db-migrate down -e prod"
      }
    > node node_modules/db-migrate/bin/db-migrate up -e prod
    > [email protected] migrate-prod-up
    
    );
    FirstName varchar(255)
    LastName varchar(255),
    PersonID int,
    received data: CREATE TABLE user (
    [INFO] Processed migration 20220523135622-migration_name
    [INFO] Done

    Enter the username and password when prompted

    Enter the WebDAV server URL in the following format: https://server-address

  • Enter the username and password when prompted

  • Complete the setup wizard

  • for Dolphin
  • Enter the username and password when prompted

  • or
    .py
    ) and with an uppercase
    P
    . The name is case-sensitive, so
    procfile
    will not work.

    The Procfile must be placed in the root directory of your project. It won't work in any other location.

    Procfile Processes

    The Procfile defines the processes that a Backend Capsule must run before deploying a backend application. Common process types include web, worker, and clock.

    Each process type must be paired with the command that should be used to run it. You can use the command to specify the port the process must run on and other process-specific options.

    Procfile Format

    The Procfile uses a key-value format, with each line defining a process type and its corresponding command, as shown below:

    Example Procfile for Flask

    Code Capsules only requires a Procfile for Python applications. Here is an example of how a Procfile for a Flask application might look:

    Procfiles for Other Languages

    Express and Java applications don't need a Procfile to be deployed. The Backend Capsule automatically detects the application type and runs the appropriate processes.

    import os
    
    db_directory = os.getenv('PERSISTENT_STORAGE_DIR')
    
    ### Do something with the db_directory variable here
    file_to_write = os.path.join(db_directory, "test.txt")
    
    file1 = open(file_to_write, "w")
    file1.write("File writing test")
    file1.close()
    
    
    db_directory = process.env.PERSISTENT_STORAGE_DIR
    const fs = require('fs')
    
    const content = 'Some content!'
    
    // Do something with the db_directory variable here
    
    fs.writeFile(db_directory + '/test.txt', content, err => {
      if (err) {
        console.error(err)
        return
      }
      //file written successfully
    })
    
    <process type>: <command>
    web: python3 -m flask run --host=0.0.0.0 --port=$PORT

    POST

    /api/context/text

    Submit context to the agent using text.

    No

    POST /api/context/text

    POST

    /api/context/url

    Submit context to the agent using a URL.

    No

    POST /api/context/url

    POST

    /api/chat/message

    Send a message to the agent with an instant response.

    Yes*

    POST

    /api/chat/message/stream

    Send a message to the agent, streaming back the response.

    Yes*

    GET

    /api/chat/history

    Get the chat history for the user.

    Yes

    X-CC-API-KEY

    This value will be the value as generated in the INTERNAL_API_KEY environment variable on creation of the Agent capsule.

    No

    X-CC-EMAIL

    This value will be the email of the user who has logged into Code Capsules, allowing for testing with unique chat sessions and chat history.

    No

    POST /api/chat/message
    POST /api/chat/message/stream
    GET /api/chat/history

    Custom Domains

    Each application deployed on Code Capsules is assigned a default domain in the format capsulename.xxxx.codecapsules.co.za.

    At no additional cost, you can configure Code Capsules to use a custom domain you own (like example.com) instead of the default domain.

    How to Add a Custom Domain

    The Domains tab contains all information about a Capsule's domain, including the option to add a custom domain.

    Before adding a custom domain:

    Each Capsule can route to only one root domain. You won't be able to add multiple root domains.

    To add a new custom domain, click the yellow + button in the top-right corner of the dashboard.

    Copy and save the Static IP address.

    Click the Add Custom Domain link and enter your custom domain in the Domain Name field.

    Ensure you enter only a root domain. Do not include a subdomain. A root domain contains only a domain name and top-level domain, for example, example.com. See the below.

    Click Create Domain.

    Create an A Record

    Next, you need to create an A record with your domain registrar for the custom domain you've purchased.

    Log in to your domain registrar's dashboard and locate the DNS settings for your custom domain.

    Retrieve the static IP address you previously copied and saved and add an A record pointing to it. Your A record entry may look something like this:

    Record Type
    Name
    IPv4 Address

    Where:

    • @ refers to your root domain (for example, example.com).

    • provided-IP-Address is the static IP address from Code Capsules.

    Consult your domain registrar's documentation for specific instructions on adding A records to your domain.

    Changes to DNS records can take several hours to propagate.

    How to Add a Subdomain

    Before adding a subdomain, make sure your custom domain has an pointing to your application on Code Capsules.

    Note:

    • Each application on Code Capsules supports a maximum of five subdomains.

    • Wildcard subdomains are not supported. You need to for each subdomain you add.

    To add a new subdomain, click the yellow + button in the top-right corner of the dashboard.

    Click the Add Custom Domain link and enter the subdomain to create in the Domain Name field.

    Click Create Domain.

    Create a CNAME Record

    Next, you need to create a CNAME record with your domain registrar for the subdomain you added.

    Log in to your registrar's dashboard and navigate to the DNS settings for your domain. Add a CNAME record for the subdomain. Your CNAME record entry may look something like this:

    Record Type
    Name
    Host/Target

    Where:

    • subdomain is the subdomain you're adding, for example, app or www.

    • your-root-domain is your root domain that contains an A record routing to your application on Code Capsules.

    Consult your domain registrar's documentation for specific instructions on adding CNAME records to your domain.

    Changes to DNS records can take several hours to propagate.

    How To Remove Domains and Subdomains

    To remove a domain or subdomain from a Capsule, go to the Capsule's Domains tab.

    All associated domains and subdomains are listed in the right-hand panel. To remove one, click the trash can icon next to the domain or subdomain.

    Removing a custom domain or subdomain does not update or delete its DNS records.

    • If you remove a root domain, update the A record with your domain registrar to remove or change the IP address.

    • If you remove a subdomain, delete the corresponding CNAME record from your DNS settings.

    Understanding URL Structure

    • Uniform Resource Locator (URL): A web address used to locate a resource on the internet. URLs typically include a subdomain, a second-level domain, and a top-level domain.

    • Subdomain: The portion of a URL before the main domain name, most commonly www. Subdomains are often used to organize different services or sections of a website (for example, hr.myapplication.com might route users to your company’s human resources portal).

    • Second-level domain (SLD): The core name of the domain, located between the subdomain and the TLD. In www.example.com

    Glossary of DNS and Web Protocol Terms

    DNS Records

    • Domain Registrar: A company that sells and manages domains.

    • A Record: Routes a domain (for example, example.com) to an IP address (for example, 123.456.567.8).

    • Wildcard Subdomain: Routes all undefined subdomains of a domain to a specific destination. For example, if the *.example.com wildcard subdomain points to example.com

    HTTP and SSL

    • Hypertext Transfer Protocol (HTTP): Protocol used to transfer data from a server (such as a web application) to a client (such as your web browser).

    • Hypertext Transfer Protocol Secure (HTTPS): A secure version of HTTP that encrypts data transferred between the server and client for better security.

    • Secure Sockets Layer (SSL) Certificate: Authenticates a domain and enables encrypted communication between a server and a client via HTTPS (for example, https://www.example.com).

    Templates

    Code Capsules provides a variety of agent template repos for you to use as the base for your Agent Capsule.

    Each template comes with a tutorial on how to successfully deploy the template, and can be accessed from our GitHub pages. See the list of available templates below:

    Template
    Functions
    GitHub repo
    ,
    example
    is the SLD.
  • Top-level domain (TLD): The final part of the domain name, such as .com, .org, or .co.za. TLDs often indicate the purpose or location of a website, for example, .de typically signals a website based in Germany, while .org is commonly used by non-profit organizations.

  • Root Domain: The combination of the SLD and TLD, excluding any subdomains, for example, example.com.

  • , then both
    info.example.com
    and
    123.example.com
    would resolve to
    example.com
    unless explicitly defined otherwise.
  • CNAME Record: Also known as an "alias", routes a subdomain to another domain name (for example, mail.example.com -> mail.google.com). Unlike A records, which point to IP addresses, CNAME records point to domain names.

  • A Record

    @

    provided-IP-Address

    CNAME

    subdomain

    your-root-domain

    notes on understanding URL structure
    A record
    create a separate CNAME record

    Google Calendar Agent

    • Base Agent functionality (forked off Base Agent)

    • Add events to Google Calendar

    • Get a list of events from Google Calendar

    https://github.com/codecapsules-io/ai-calendar-agent-template

    Architecture

    Each template consists of the same base architecture, containing the following:

    • A list of endpoints: required for interaction with the Code Capsules Agent Chat tab

    • A memory store: allows for the agent to retain overall memory. Useful when the agent needs to store some memory "globally" (i.e. will be applied across all prompts). By default, a connection attempt will be made to a Redis instance, but will fall back to an in-memory store if unavailable

    • A vector store: allows for the agent to gain context through RAG. Using the prescribed endpoints, one can add context using text or a URL. By default, a connection attempt will be made to a Redis instance, but will fall back to an in-memory vector store if unavailable

    Creating a New Agent

    Follow the following procedure to begin creating your new agent. In this example, we will use Google as the provider, but there are other options available.

    1. If you already have a free or paid tier Google AI Studio account and API key, you can move to step 3, else continue to step 2.

    2. Follow the following guidelines to create a new Google Gemini API key: https://ai.google.dev/gemini-api/docs/api-key. Make sure to copy your key somewhere safe as it will be needed later.

    3. Navigate to one of the template repositories on GitHub as described above. If you are new to AI Agent development, it is recommended to start with a simple Base Agent.

    4. Using the template repo, create your own new repository by following the steps here: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template#creating-a-repository-from-a-template.

    5. Follow the setup steps for the template in the relevant README.md file which can be found in the same GitHub repository.

    6. , linking your newly created repo, and adding your provider, model, and API key when requested.

    7. Once the capsule is built, navigate to the Chat page - ask your newly deployed Agent Capsule anything you'd like! Remember: if you are using a template, the agent will most likely be confined to a specific purpose, so be sure to read the README.md file for more information on its capabilities.

    8. You can now modify your codebase however you'd like to include new tools, context, and more.

    Agent Capsule templates have been built with the capabilities of using either a Redis or in-memory vector store. When using the in-memory option (i.e. no Redis Capsule is linked), it is recommended to scale the Agent Capsule to the following in order to ensure optimal performance:

    • CPU 25%

    • Memory 1GB

    • Replicas 1

    To do this, visit the Agent Capsule page.

    Setting up a Vector Store (RAG)

    Each template has been written to use memory as a vector store for RAG. However, the templates also cater for connections to a Redis instance as its vector store. In order to set this up, follow the following steps:

    1. Create a Redis Capsule.

    2. Copy the Connection String in the Details tab of your Redis Capsule.

    3. Navigate to the Config page of your Agent Capsule.

    4. On the Environment Variables section (on the right-hand side), click the Text Editor.

    5. Add the following at the bottom of the Environment Variables list:

    1. Wait for the Agent Capsule to restart - it should now use the Redis Capsule as its vector store.

    Testing RAG

    In order to test RAG functionality, do the following:

    1. Make a call to the following endpoint:

    1. Navigate to the Agent Capsule Chat tab.

    2. Ask the agent the following question:

    The agent should respond with something along the lines of:

    Accessing documentation

    All agent templates come with pre-written OpenAPI documentation. In order to access this documentation, an environment variable needs to be added to the Agent Capsule. Follow the following steps to do so:

    1. Open Code Capsules.

    2. Navigate to the Config page of your Agent Capsule.

    3. On the right-hand side, in the Environment Variables section, click 'Text Editor'.

    4. Paste the following into the bottom of the editor:

    1. Click 'Save'.

    2. Wait for the Agent Capsule to restart.

    3. Navigate to the 'Details' page of your Agent Capsule.

    4. Copy the 'Public URL' link.

    5. In a new browser tab, paste the URL and append /api-docs to the end of the URL.

    6. Once the page is loaded, you should see some fully functional OpenAPI documentation for your agent, unique to your selected agent template.

    These documents are served directly from the src/docs/swagger.json file in the agent repo.

    Customisation

    If you've followed the above steps to create an Agent Capsule, you're probably now looking into how you can add your own tools, context, and other customisation. Follow the topics below to investigate how to do this.

    Changing the Provider and Model

    Changing the public AI provider and model through the Code Capsules site is easy. You can do this by navigating to the Config page for the Agent Capsule. Here, you can edit the Agent Config to change these details to cater your needs. After the changes are applied, the Agent Capsule will restart and use your newly provided configuration. See more here.

    Changing the System Prompt

    Each agent template comes with a pre-written system prompt found in the src/modules/agent/config/system-prompt.ts file. This will provide your agent with a base prompt from which it will build it's context.

    It is important to note that changing this prompt will require you to push your changes to the relevant GitHub repo and branch, and ensuring that a new build is started in Code Capsules. Once the build is complete, your changes will be ready for use.

    Adding New Tools

    Adding a new tool to your agent has been made easy with the simple layout structure built into the agent templates. Follow these simple steps to add a new tool, with a side-by-side example of creating a new getWeather tool.

    1. Navigate to the /src/modules/agent/tools/implementations folder.

    2. Create a new file to describe your new tool.

    New file: src/modules/agent/tools/implementations/my-new-tool.tool.ts

    New file: src/modules/agent/tools/implementations/get-weather.tool.ts

    1. In your new file, add code with the following structure, replacing where necessary:

    1. In the src/modules/agent/tools/implementations/index.ts file, export your new tool.

    1. In the src/modules/agent/tools/tools-manager.ts file, add your new tool to the list in the constructor.

    1. (Optional) Add new System Prompt context in the src/modules/agent/config/system-prompt.ts file.

    1. Push your code.

    1. Code Capsules, if configured to do so, will automatically rebuild your Agent Capsule. Once complete, navigate to your Chat page and ask the agent a question.

    Base Agent

    • Basic agent communication

    • RAG (context) functionality

    Telegram Bot Agent

    • Base Agent functionality (forked off Base Agent)

    • Runs a Telegram bot which calls the agent for communication

    https://github.com/codecapsules-io/ai-agent-template
    https://github.com/codecapsules-io/ai-telegram-bot-agent-template
    curl -L \
      --request POST \
      --url '{agent_capsule_public_url}/api/context/text' \
      --header 'Content-Type: application/json' \
      --data '{
        "text": "George is the king of the jungle. He likes hats and eats snails."
      }'
    const response = await fetch('{agent_capsule_public_url}/api/context/text', {
        method: 'POST',
        headers: {
          "Content-Type": "application/json"
        },
        body: JSON.stringify({
          "text": "George is the king of the jungle. He likes hats and eats snails."
        })
    });
    
    const data = await response.json();
    src/modules/agent/tools/implementations/my-new-tool.tool.ts
    import { z } from "zod";
    import { tool } from "langchain";
    
    import { BaseTool } from "../base.tool";
    
    export class NewTool implements BaseTool {
      public tool = tool(
        async (input) => {
          return `New tool with input ${input.anInputString}`;
        },
        {
          name: "newTool",
          description: "New tool with an input string",
          schema: z.object({
            anInputString: z.string(),
          }),
        }
      );
    }
    
    src/modules/agent/tools/implementations/get-weather.tool.ts
    import { z } from "zod";
    import { tool } from "langchain";
    
    import { BaseTool } from "../base.tool";
    
    export class GetWeatherTool implements BaseTool {
      public tool = tool(
        async (input) => {
          return `The weather in ${input.location} is sunny and 20 degrees!`;
        },
        {
          name: "getWeather",
          description: "Get the weather in a location",
          schema: z.object({
            location: z.string().describe("The location to get the weather for"),
          }),
        }
      );
    }
    
    src/modules/agent/tools/implementations/index.ts
    export * from "./new-tool";
    src/modules/agent/tools/implementations/index.ts
    export * from "./get-weather.tool";
    src/modules/agent/tools/tools-manager.ts
    this.tools.push(new NewTool());
    src/modules/agent/tools/tools-manager.ts
    this.tools.push(new GetWeatherTool());
    src/modules/agent/config/system-prompt.ts
    You are a helpful assistant with access to the following tool:
    newTool - a new tool which retrieves an inut string and returns the same string.
    This is a very basic tool which is just for testing Agent functionality, so ensure to just fire off this tool as necessary without being concerned about input or output. 
    An example of a user wanting to fire this would be "Please use my newTool with the input 'Hello, friend!'"
    src/modules/agent/config/system-prompt.ts
    You are a helpful assistant with access to the following tool:
    getWeather - a tool used to get the weather of a specific location.
    This is a very basic tool which is just for testing Agent functionality, so ensure to just fire off this tool as necessary without being concerned about input or output. It only returns that the weather is sunny in the provided location, and this is what is expected.
    An example of a user wanting to fire this would be "What is the weather in Tokyo today?", which should return "The weather in Tokyo is sunny and 20 degrees". This can then be formatted into a nice, unique sentence for the user.
    Please use my newTool with the input 'Hello, friend!'
    What is the weather in Tokyo today?
    REDIS_URL=your_copied_connection_string
    Who is the king of the jungle?
    George is the king of the jungle. He likes hats and eats snails.
    SHOW_DOCUMENTATION=true
    git add .
    git commit -m "Added new tool"
    git push origin main
    Create a new Agent Capsule
    Scale
    Teams
    Spaces
    Capsule
    Python
    Django
    Flask
    Express.js
    Java
    Go
    Caddy Docker Site
    Docker Laravel App
    Docker PHP App
    Flask Docker App
    Backend
    Django + MySQL
    Flask + MySQL
    Java + MySQL
    Django + MongoDB
    Express + MongoDB
    Flask + MongoDB
    Postgres
    Redis
    Database
    setting up a MySQL Data Capsule
    creating an Express application with Code Capsules
    React
    Angular
    Vue
    Next.js
    Svelte
    Static HTML
    HTML5UP Template
    Bootstrap
    Frontend

    Python Application

    Step-by-step guide to deploying a Python app using Flask or Django.

    Redis Database

    Configure and deploy a Redis instance.

    PostgreSQL Database

    Set up and manage a PostgreSQL Capsule.

    MySQL Database

    Deploy and configure MySQL on Code Capsules.

    MongoDB Database

    Guide to running MongoDB in a Database Capsule.

    Send a message to the AI agent

    post

    Send a message to the conversational AI agent and receive a complete response. For streaming responses, use the /message/stream endpoint instead.

    Authorizations
    X-CC-API-KEYstringRequired

    API key for authentication

    Body
    datestring · date-timeRequired

    Timestamp of the message

    Example: 2025-11-07T10:30:00Z
    post
    /api/chat/message

    Stream a message from the AI agent

    post

    Send a message to the conversational AI agent and receive a streaming response. The response is sent as Server-Sent Events (SSE) with each chunk containing the type and content.

    Authorizations
    X-CC-API-KEYstringRequired

    API key for authentication

    Body
    datestring · date-timeRequired

    Timestamp of the message

    Example: 2025-11-07T10:30:00Z
    Responses
    200

    Successful streaming response from the AI agent

    text/event-stream
    Responsestring

    Server-Sent Events stream containing message chunks

    400

    Bad request - Message is required

    application/json
    401

    Unauthorized - Invalid or missing authentication headers

    application/json
    500

    Internal server error

    application/json
    post
    /api/chat/message/stream

    Get chat history for the authenticated user

    get

    Retrieve the complete chat history for the currently authenticated user, including all previous conversations.

    Authorizations
    X-CC-API-KEYstringRequired

    API key for authentication

    Responses
    200

    Chat history retrieved successfully

    application/json
    401

    Unauthorized - User not authenticated or missing user information

    application/json
    500

    Internal server error

    application/json
    get
    /api/chat/history

    Add text context to the vector store

    post

    Add text content to the vector store for use in RAG (Retrieval-Augmented Generation) context retrieval.

    Authorizations
    X-CC-API-KEYstringRequired

    API key for authentication

    Body
    textstringRequired

    The text content to be added to the vector store

    Responses
    200

    Context added successfully

    application/json
    400

    Bad request - Context text is required

    application/json
    401

    Unauthorized - Invalid or missing authentication headers

    application/json
    500

    Internal server error

    application/json
    post
    /api/context/text

    Add context from URL to the vector store

    post

    Fetch content from a URL and add it to the vector store for use in RAG (Retrieval-Augmented Generation) context retrieval.

    Authorizations
    X-CC-API-KEYstringRequired

    API key for authentication

    Body
    urlstring · uriRequired

    The URL to fetch content from

    Example: https://example.com/article
    Responses
    200

    Context added successfully

    application/json
    400

    Bad request - URL is required

    application/json
    401

    Unauthorized - Invalid or missing authentication headers

    application/json
    500

    Internal server error

    application/json
    post
    /api/context/url
    Responses
    200

    Successful response from the AI agent

    application/json
    400

    Bad request - Message content is required

    application/json
    401

    Unauthorized - Invalid or missing authentication headers

    application/json
    500

    Internal server error

    application/json
    {
      "data": [
        {
          "role": "user",
          "content": [
            {
              "text": "Hello there"
            }
          ],
          "date": "2025-12-16T14:35:53.199Z"
        }
      ],
      "success": true
    }
    POST /api/chat/message HTTP/1.1
    Host: 
    X-CC-API-KEY: YOUR_API_KEY
    Content-Type: application/json
    Accept: */*
    Content-Length: 80
    
    {
      "content": [
        {
          "type": "text",
          "text": "Hello there"
        }
      ],
      "date": "2025-11-07T10:30:00Z"
    }
    POST /api/chat/message/stream HTTP/1.1
    Host: 
    X-CC-API-KEY: YOUR_API_KEY
    Content-Type: application/json
    Accept: */*
    Content-Length: 80
    
    {
      "content": [
        {
          "type": "text",
          "text": "Hello there"
        }
      ],
      "date": "2025-11-07T10:30:00Z"
    }
    text
    GET /api/chat/history HTTP/1.1
    Host: 
    X-CC-API-KEY: YOUR_API_KEY
    Accept: */*
    
    {
      "data": [
        {
          "role": "user",
          "content": [
            {
              "text": "Hello there"
            }
          ],
          "date": "2025-12-16T14:35:53.199Z"
        }
      ],
      "success": true
    }
    POST /api/context/text HTTP/1.1
    Host: 
    X-CC-API-KEY: YOUR_API_KEY
    Content-Type: application/json
    Accept: */*
    Content-Length: 15
    
    {
      "text": "text"
    }
    {
      "success": true
    }
    POST /api/context/url HTTP/1.1
    Host: 
    X-CC-API-KEY: YOUR_API_KEY
    Content-Type: application/json
    Accept: */*
    Content-Length: 37
    
    {
      "url": "https://example.com/article"
    }
    {
      "success": true
    }