Overview

Workspace environments facilitate isolated and secure execution of tools with customizable configurations. The SWE Development Kit (swekit) provides a range of environments tailored to your agents’ needs, encompassing security, configuration, CPU allocation, and network port access for public services.

Why Workspace Environments Matters?

Workspace environments are essential for:

  • Security: Isolating execution to protect the host system and sensitive data.
  • Specific Configuration Needs: Tailoring the environment to the requirements of different agents.
  • Resource Allocation: Allocating specific CPU and memory resources to agents.
  • Networking: Configuring open ports for services that need to be accessible publicly.

Supported Environments

Configuring Workspace Environments

Configurable Parameters

When configuring your workspace environment, consider the following customizable parameters to tailor the environment to your SWE agents’ needs:

  • github_access_token: Optional. This token is used for GitHub operations. If not provided, the token from the active composio account will be utilized.
  • environment: Optional. A set of key-value pairs representing environment variables specific to the workspace’s needs.
  • persistent: A boolean flag, when set to True, ensures that the workspace persists beyond the execution of an agent. This is particularly useful for scenarios where you want your agent to deploy a service, such as a website, and require that the service remains active and accessible after the agent’s task is complete.
  • ports: Optional. A dictionary specifying the port mappings for services that need to be publicly accessible. For example, if your agent is running a web server, you can map the internal port to an external one to allow public access.

These parameters empower you to customize the security, configuration, resource allocation, and networking aspects of your workspace environment, ensuring optimal conditions for your SWE agents’ operation.

Local Environment

To run your agent on the local machine:

Docker Environment

For enhanced security and isolation, use Docker:

You can configure exposed ports for development:

For more details on configuring Docker ports, refer to the Docker Python SDK documentation.

E2B Environment

To use E2B sandboxes for cloud-based execution:

To use E2B sandboxes, you need to set the E2B_API_KEY environment variable with your E2B API key.

FlyIO Environment

For scalable, distributed execution on Fly.io:

You can configure ports for development or deployment:

For more information on configuring network ports on Fly.io machines, check the Fly.io Machines API documentation.

To use Fly.io, you need to set the FLY_API_TOKEN environment variable with your Fly.io API token.

Customizing Workspace Environment Variables

You can customize the workspace environment by adding environment variables while creating workspace.

Retrieve Workspace Network Details

To effectively manage and interact with your workspace configuration, the ComposioToolSet() object exposes several properties:

Access the workspace’s hostname using toolset.workspace.host. This hostname, which is typically localhost for Docker and local environments, becomes a publicly accessible address for E2B and Fly.io workspaces. It’s vital for hosting services and establishing network connections. Retrieve it manually or programmatically with as_prompt.

These tools are designed to provide you with all the necessary details for efficient workspace management and service deployment.

Was this page helpful?