Containers
Docker container lifecycle management for agent containers.
| CLASS | DESCRIPTION |
|---|---|
ContainerError |
Raised when a container operation fails. |
ContainerManager |
Manages Docker container start/stop for configured agent types. |
Classes¶
ContainerManager
¶
Manages Docker container start/stop for configured agent types.
On startup, pull (if needed) and start agent containers.
On shutdown, call stop_all to stop them.
The container lifecycle manager registers URLs with the router after each successful start.
| RAISES | DESCRIPTION |
|---|---|
ContainerError
|
If the Docker socket is unavailable at construction time. |
| METHOD | DESCRIPTION |
|---|---|
handle_container_exit |
Handle an unexpected container exit with one restart attempt. |
start_agent |
Pull (if needed), start the container, wait for health, return URL. |
stop_all |
Stop all managed containers. |
Functions¶
handle_container_exit
¶
Handle an unexpected container exit with one restart attempt.
If the container has already been restarted once and exits again, it is marked as permanently failed and no further restart is attempted.
| PARAMETER | DESCRIPTION |
|---|---|
agent_type
|
Agent type identifier.
TYPE:
|
image
|
Docker image to restart.
TYPE:
|
port
|
Host port for the restarted container.
TYPE:
|
start_agent
¶
Pull (if needed), start the container, wait for health, return URL.
| PARAMETER | DESCRIPTION |
|---|---|
agent_type
|
Agent type identifier (e.g.
TYPE:
|
image
|
Docker image name/tag to run.
TYPE:
|
port
|
Host port to bind the container's port 8000 to.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The base URL of the running container (e.g. |
| RAISES | DESCRIPTION |
|---|---|
ContainerError
|
If the container fails to become healthy. |