Skip to main content

No project description provided

Project description

Composabl

Composabl helps you build Autonomous Agents! Through an easy SDK you get access to outscaled simulator training tools.

Getting Started

To get started and run your experiments, let's follow these steps

Prerequisites

Demo

python -m composabl.main

Training your first Agent

Save the below as main.py and run it with python main.py

from composabl.agent import Agent, Scenario, Skill

stabilize_scenarios = [
    {
        "angle": 0,
        "horizontal_position": [-0.2, 0.2],
        "vertical_position": [-0.5, -0.5],
        "velocity": [-0.2, 0.2],
    },
    {
        "angle": -.17,
        "horizontal_position": [-0.5, 0.5],
        "vertical_position": [-0.5, -0.25],
        "velocity": 0
    },
    {
        "angle": 0.12,
        "horizontal_position": [-0.7, 0.7],
        "vertical_position": [-.65, -0.1],
        "velocity": 0
    }
]

def stabilize_reward():
    """
    if {{{prev_state}}} is None:
        reward = 0
    VIEWPORT_W = 600
    VIEWPORT_H = 400
    SCALE = 30.0

    reward = 0
    # has the angle moved closer to 0?
    if abs({{prev_state[4]}}) >= abs({{state[4]}}) + 0.1 * 180 / math.pi:
        reward += 1
    # has the x position remained stable?
    if abs({{prev_state[0]}} - {{state[0]}}) <= 0.01 * (VIEWPORT_W / SCALE / 2):
        reward += 1
    else:
        reward -= 1
    # has the y position remained stable?
    if abs({{prev_state[1]}} - {{state[1]}}) <= 0.01 * (VIEWPORT_W / SCALE / 2):
        reward += 1
    else:
        reward -= 1
    """


def main():
    stabilize_skill = Skill("stabilize", stabilize_reward(), trainable=True)
    for scenario_dict in stabilize_scenarios:
        scenario = Scenario(scenario_dict)
        stabilize_skill.add_scenario(scenario)

    agent = Agent({
        "license": "<LICENSE_KEY>",
        "env": {
            "strategy": "local",  # "docker", "kubernetes", "local"
            "config": {
                "address": "localhost:1337",
                # "image": "composabl.ai/sim-gymnasium:latest"
            }
        }
    })
    agent.add_skill(stabilize_skill)
    agent.train(train_iters=5000)


if __name__ == "__main__":
    main()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

composabl-0.0.1.dev1-cp38-cp38-manylinux_2_35_x86_64.whl (5.9 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.35+ x86-64

composabl-0.0.1.dev1-cp38-cp38-macosx_12_0_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.8 macOS 12.0+ x86-64

Supported by

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