LogoLogo
  • Welcome to Composabl
  • Get Started
  • Reference
    • CLI Reference
    • SDK Reference
    • Glossary
    • Sample Use Cases
  • Tutorials
    • Industrial Mixer
      • Get Started
      • Deep Reinforcement Learning
      • Strategy Pattern
      • Strategy Pattern with a Perception Layer
      • Plan-Execute Pattern
  • Establish a Simulation Environment
    • Simulation Overview
    • Connect a Simulator to Composabl
    • Composabl Simulation API
  • Build Multi-Agent Systems
    • Anatomy of a Multi-Agent System
    • Create a Use Case
    • Set Goals, Constraints, and Success Criteria
    • Create Skill Agents
      • Create Skill Agents
      • Create Skill Agents with Rewards Using the SDK
      • Configure Programmed Algorithms as Skill Agents
      • Configure API Connections to Third-Party Software as Skill Agents
    • Orchestrate Skill Agents
    • Configure Scenarios
    • Add a Perception Layer
      • Create a New Perceptor
      • Configure an ML Model as a Perceptor
      • Configure an LLM Model as a Perceptor
    • Publish Skill Agent Components to the UI
  • Train Agents
    • Submit a Training Job through the UI
    • Analyze Agent System Behavior
      • View Training Session Information
      • Analyze Data in Detail with the Historian
  • Evaluate Performance
    • Set KPI and ROI
    • Analyze Data
  • Deploy Agents
    • Access a Trained Agent System
    • Deploy an Agent System in a Container
    • Deploy an Agent System as an API
    • Connect Runtime Container to Your Operation
    • Connecting to Agent System Runtime and Plotting Results of Agent System Operations
  • clusters
    • Creating a Cluster
      • Manual
      • Automated
      • Azure
    • Connecting a Cluster
  • Troubleshooting
    • Resolving Certificate Issues for Installing the Composabl SDK on WSL
Powered by GitBook
On this page
  • Tutorial: Accessing the Agent System Runtime After Deploying to Docker
  • Step 1: Preparing the Dockerfile and Environment
  • Step 2: Building the Docker Image
  • Step 3: Running the Docker Container
  • Step 4: Accessing the Agent System Runtime
  • Conclusion
Export as PDF
  1. Deploy Agents

Deploy an Agent System in a Container

PreviousAccess a Trained Agent SystemNextDeploy an Agent System as an API

Last updated 23 days ago

Based on the notes provided in the image, we'll help you create a tutorial on accessing the agent system runtime after deploying it to Docker. This tutorial will explain the steps for building the Docker container, deploying the agent system, and accessing the runtime for inference or interaction.


Tutorial: Accessing the Agent System Runtime After Deploying to Docker

Once you have packaged and deployed your agent system inside a Docker container (https://docs.composabl.com/deploy-agents/deploy-an-agent-in-a-container), the next step is accessing its runtime for operations like model inference. This tutorial will guide you through the process of building and running the Docker container and then connecting to the agent system's runtime for further interactions.


Step 1: Preparing the Dockerfile and Environment

To deploy the agent system to Docker, we need to first create an image from the Dockerfile (https://docs.composabl.com/deploy-agents/deploy-an-agent-in-a-container). The Dockerfile will package the necessary runtime, model, and environment for the agent system.

Step 2: Building the Docker Image

  1. Building the Image: You can build the Docker image by running the following command in the terminal. This will take the Dockerfile and the associated files (like the pre-trained model) and create an image.

docker build -t composabl_agent_api .
  • The -t flag allows you to tag the image (composabl_agent_api), which makes it easier to reference later.

  • Make sure that the model file (agent.json) and all relevant scripts are reachable within the Docker context (i.e., the directory from which you are building).

  1. Checking the Image: Once the build is complete, you can verify that the image was created successfully by running:

docker images

Step 3: Running the Docker Container

Now that the image is built, the next step is to run it in a container. You will run the Docker container in an interactive mode to access the runtime.

docker run -e COMPOSABL_LICENSE="<your_license>" -it -p 8000:8000 composabl_agent_api
  • -it: Runs the container interactively.

  • -p 8000:8000: Maps port 8000 from the container to port 8000 on your local machine so that you can access the HTTP server for the agent system runtime.

  • -e COMPOSABL_LICENSE="<your_license>" : is exporting the environment variable and linking to your composabl license

The HTTP server should now be up and running within the container, ready to handle model inference or other tasks.


Step 4: Accessing the Agent System Runtime

With the Docker container running, you can now connect to the agent system's runtime. The runtime will be an HTTP server, as mentioned in your notes. You can access it through a POST request for model inference or other operations.

  1. Sending Requests to the Agent System: You can send a POST request to the running server using a tool like curl, Postman, or any Python HTTP library (such as requests).

Here’s an example using curl:

curl -X POST http://localhost:8000/predict -H "Content-Type: application/json" -d '{"observation": {"T": 311.0, "Tc": 292.0, "Ca": 8.56, "Cref": 8.56, "Tref": 311.0, "Conc_Error": 0.0, "Eps_Yield": 0.0, "Cb_Prod": 0.0}}'

This request will:

  • POST data to the /predict endpoint on localhost:8000, which is being forwarded from the Docker container.

  • The agent system will handle the request, infer the model, and return the action as a result.


Conclusion

In this tutorial, we walked through the process of:

  • Building a Docker image with your agent system and its runtime.

  • Running the Docker container interactively to expose the agent system’s HTTP server.

  • Accessing the agent system runtime by sending HTTP requests for inference or other tasks.

By following these steps, you can deploy and interact with your Composabl agent system in a Dockerized environment.