Skip to main content

Python SDK for the Abundant Environment API - simulation environments for RL agent training

Project description

Simulation Environment API

FastAPI-based API service for managing simulation environments for RL agent training. Currently supports Salesforce scratch orgs with browser automation via Browserbase.

Production API: https://api.abundant.systems/

Overview

This API provides:

  • Isolated browser instances of simulated websites
  • Direct CDP access for agent control
  • Clean separation between simulated environment and test harness controls
  • Realistic environment URLs

V1 API Endpoints

Environment Discovery

  • GET /v1/environments - List available simulation environments

Instance Lifecycle

  • POST /v1/instances - Create new environment instance
  • GET /v1/instances/{id} - Get instance details with CDP URL
  • DELETE /v1/instances/{id} - Terminate instance

Control Operations

  • POST /v1/instances/{id}/reset - Reset instance to clean state
  • POST /v1/instances/{id}/verify - Run verification function
  • GET /v1/instances/{id}/state - Get current state

TODO

High Priority

  • Implement Salesforce-specific verification functions

Medium Priority

  • Update authentication to support Bearer token format
  • Create Python client SDK

Low Priority

  • Remove or deprecate old /salesforce endpoints
  • Add WebSocket support for real-time state updates
  • Multi-region support

Installation

uv sync

This will install all dependencies including the Foundry SDK from Test PyPI.

Usage

  1. Set up environment variables in .env:

    API_SECRET_KEY=your_secret_key
    FOUNDRY_API_KEY=your_foundry_api_key
    BROWSERBASE_API_KEY=your_browserbase_api_key
    BROWSERBASE_PROJECT_ID=your_browserbase_project_id
    
  2. Run the server:

    uv run simulation-env-api
    

    Customize server settings in src/simulation_env_api/uvicorn_config.py if needed.

  3. Access docs at http://localhost:8000/docs

Example Usage

List available environments

curl -X GET "http://localhost:8000/v1/environments"

Create an instance

curl -X POST "http://localhost:8000/v1/instances" \
     -H "x-api-key: your_secret_key" \
     -H "Content-Type: application/json" \
     -d '{"environment": "salesforce_sales"}'

Get instance details (includes CDP URL)

curl -X GET "http://localhost:8000/v1/instances/{instance_id}" \
     -H "x-api-key: your_secret_key"

Reset instance

curl -X POST "http://localhost:8000/v1/instances/{instance_id}/reset" \
     -H "x-api-key: your_secret_key"

Python SDK

A Python SDK is included for easier integration:

import asyncio
from abundant_sdk import Client

async def main():
    async with Client(api_key="your_secret_key") as client:
        # Create and use an instance
        instance = await client.create_instance("salesforce_sales")
        print(f"CDP URL: {instance.cdp_url}")

        # Verify task completion
        result = await instance.verify("opportunity_created")

        # Clean up
        await instance.terminate()

asyncio.run(main())

See examples/ directory for more detailed examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abundant_sdk-0.2.3.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

abundant_sdk-0.2.3-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file abundant_sdk-0.2.3.tar.gz.

File metadata

  • Download URL: abundant_sdk-0.2.3.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for abundant_sdk-0.2.3.tar.gz
Algorithm Hash digest
SHA256 fffbdf7c2a4e7b154f21966d53be429067be90304d7a769c1896d8cac77fac37
MD5 ed8da54e90b641c73ce9b9feb4d2535d
BLAKE2b-256 ed11364ebb4b794bca871e07d7fd538f1f4f5b847232b7ffa3d04af4a0fd1338

See more details on using hashes here.

File details

Details for the file abundant_sdk-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: abundant_sdk-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for abundant_sdk-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 95a5c18727decd09f8c25064b90b4ea4b4085308f119047aa152c5472d66d231
MD5 5f915a324d8efbe97ddb6030b318bcdf
BLAKE2b-256 4d5e0895c33bf7c9e433f0a85a352f073319cca3e01688afaea5b182c95e9138

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page