manage_modal_container
Run commands inside or stop a running Modal container by providing its ID. Use 'exec' for remote command execution or 'stop' to terminate it.
Instructions
Act on one running container. Find IDs with
list_modal_resources(resource="containers").
Args:
action: "exec" — run a command inside the container (`modal container exec`).
This is arbitrary remote code execution: treat it like SSH, not a lookup.
"stop" — terminate it (`modal container stop`); in-flight inputs are
cancelled and rescheduled elsewhere.
container_id: Container ID ("ta-..."). Unique across environments, so no `env`
argument is needed (the CLI accepts none for these subcommands).
command: For "exec": argv list, e.g. ["python", "-c", "print('hi')"] or
["ls", "-la", "/"].
timeout_seconds: For "exec": max seconds to wait. Default 60.
Returns: exec → {output, returncode, truncated, output_capped}; stop → {message}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| command | No | ||
| container_id | Yes | ||
| timeout_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |