Multi-environment Agent

A single agent that operates across multiple isolated shell execution environments - using blueprint introspection to discover available environments and dynamically installing the right skillset to execute commands in the correct sandbox.

multi-environment
sandbox
shell
2259

The Multi-environment Agent blueprint demonstrates how a single agent can operate across multiple isolated shell execution environments by dynamically loading different skillsets at runtime.

The Core Problem

When an agent needs to work across different environments (development, staging, production, or simply different project workspaces), each environment must maintain its own shell session state, file system, and installed dependencies. If the agent used a single shell/exec ability, all commands would run in the same sandbox - mixing state, leaking environment variables, and making it impossible to tell which environment produced which output.

The Solution: One Skillset Per Environment

Each environment is represented by a separate skillset containing its own shell/exec and shell/rw abilities, each bound to a dedicated space. Because the shell session is tied to the skillset's space, each environment gets its own isolated sandbox with persistent state. The agent installs the skillset for the environment it needs, runs commands there, and can switch to another environment by installing a different skillset.

How It Works

The agent starts with a core skillset that provides two meta-abilities:

  1. List Environments uses blueprint/resource/list filtered to type: skillset to discover all available environment skillsets. Each skillset's name and description tell the agent what the environment is for (e.g. "Development" vs "Staging" vs "Production").

  2. Install Environment uses conversation/skillset/install[by-id] to dynamically load a skillset into the current conversation. Once installed, the agent gains access to that environment's shell and file abilities.

Each environment skillset contains:

  • A shell/exec ability bound to its own space for command execution
  • A shell/rw ability bound to the same space for reading and writing files

Because each space is independent, commands in the Development environment cannot affect the Staging environment, and vice versa. Environment variables, installed packages, and file state are all isolated.

Why Separate Skillsets Matter

Without separate skillsets, there is no way to maintain distinct shell sessions or know which sandbox a command runs in. The skillset is the unit of session isolation - it binds abilities to a specific space, and the space provides the sandbox. This is what makes multi-environment operation possible: the agent does not just switch contexts mentally, it physically switches to a different execution environment.

Use Cases

  • Dev/Staging/Prod workflows - test a script in development, then run the same commands in staging to verify, and finally execute in production.
  • Multi-project workspaces - each project gets its own environment with its own dependencies and configuration.
  • Isolated experimentation - try something risky in one environment without affecting others.
  • Comparative testing - run the same script in two environments and compare outputs to detect environment-specific issues.

Getting Started

  1. Chat with the agent and ask it to list available environments.
  2. Ask the agent to install the Development environment.
  3. Run commands - they execute in the Development sandbox.
  4. Ask the agent to install the Staging environment.
  5. Run the same commands - they execute in a completely separate sandbox with its own state.

Backstory

Common information about the bot's experience, skills and personality. For more information, see the Backstory documentation.

You are an AI assistant that can operate across multiple isolated shell execution environments. Each environment has its own sandbox with independent state, file system, and configuration. ## HOW YOU WORK You start with a core set of abilities for discovering and loading environments. Each environment is a separate skillset with its own shell and file access bound to a dedicated space. ### SWITCHING ENVIRONMENTS 1. LIST ENVIRONMENTS Call "List Environments" to discover all available environment skillsets. Each entry shows the environment's name and description. 2. INSTALL ENVIRONMENT Call "Install Environment" with the id of the environment you want to use. This loads that environment's shell and file abilities into the current conversation. 3. EXECUTE Use the newly available shell and file abilities to run commands in that environment's isolated sandbox. 4. SWITCH To work in a different environment, install its skillset. You can install multiple environments in the same conversation and switch between them freely. ## IMPORTANT - Each environment is a completely separate sandbox. Files created in one environment do not exist in another. - Environment variables, installed packages, and running processes are isolated per environment. - Always confirm which environment you are about to execute in before running destructive or state-changing commands. - When the user asks to run something, clarify which environment they want if it is ambiguous. - The current date is ${EARTH_DATE}

Skillset

This example uses a dedicated Skillset. Skillsets are collections of abilities that can be used to create a bot with a specific set of functions and features it can perform.

  • ♻️

    List Environments

    Discovers all available environment skillsets in the blueprint. Returns the id, name, and description of each environment.
  • ♻️

    Install Environment

    Dynamically installs an environment skillset by id, giving access to that environment's shell and file abilities.
  • 🇩🇪

    bash

    Execute shell commands in the Development sandbox
  • 🇩🇪

    rw

    Read or write files in the Development sandbox
  • ✂️

    bash

    Execute shell commands in the Staging sandbox
  • 🈂️

    rw

    Read or write files in the Staging sandbox
  • bash

    Execute shell commands in the Production sandbox
  • rw

    Read or write files in the Production sandbox

Terraform Code

This blueprint can be deployed using Terraform, enabling infrastructure-as-code management of your ChatBotKit resources. Use the code below to recreate this example in your own environment.

Copy this Terraform configuration to deploy the blueprint resources:

Next steps:

  1. Save the code above to a file named main.tf
  2. Set your API key: export CHATBOTKIT_API_KEY=your-api-key
  3. Run terraform init to initialize
  4. Run terraform plan to preview changes
  5. Run terraform apply to deploy

Learn more about the Terraform provider

A dedicated team of experts is available to help you create your perfect chatbot. Reach out via or chat for more information.