Skip to content

Creating the Agent Shell

The first step in building your intelligent autonomous agent is to define a Composabl agent in a Python file. You can name this file anything you want (e.g. agent.py) and will use this file name to start agent training from the command line.

Importing the Composabl Modules

The Composabl Python library provides modules for managing agents, skills, and scenarios.

python
from composabl import Agent, Skill, Sensor, Perceptor, Scenario, Trainer

Configure the Settings for your Agent

Next, you will need to configure the settings for your agent. Add this code block to your Python file. The env key contains the name of your simulation environment, your compute target, and the pointer to your simulation environment.

python
config = {
    "target": {
        "docker": {
            "image": "composabl/sim-demo:latest"
        }
    },
    "env": {
        "name": "sim-demo",
    },
    "license": "<This is your license key>",
    "training": {},
}

Create your Agent

Establish a trainer with the Trainer() call, and finally, create your agent with the Agent() method call. Add these calls to your Python file.

python
trainer = Trainer(config)
agent = Agent()

Now we have the following agent starter that we will fill in on future steps.

python

from composabl import Agent, Skill, Sensor, Perceptor, Scenario, Trainer

config = {
    "target": {
        "docker": {
            "image": "composabl/sim-demo:latest"
        }
    },
    "env": {
        "name": "sim-demo",
    },
    "license": "<This is your license key>",
    "training": {},
}

trainer = Trainer(config)
agent = Agent()