trading_agent.scheduling.command_job_runner
¶
Runs a scheduled command job: one shell command in the desk's sandbox, with no model.
The command runs with bash -c inside the same bwrap sandbox as the desk's bash tools, so it can read the filesystem except hidden secrets and write only in the desk's scratch folder. It is stopped after its time limit, and at most 4,000 characters of its output are kept.
Typical usage example:
exit_code, output = await CommandJobRunner(sandbox, 120.0).run('python3 scan.py')
CommandJobRunner
¶
Runs command jobs for one desk.
Creates the runner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sandbox
|
BashSandbox
|
The desk's sandbox. |
required |
timeout_seconds
|
float
|
How long one command may run. |
required |
Source code in src/trading_agent/scheduling/command_job_runner.py
run
async
¶
Runs one command and collects its output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
The shell command. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int | None, str]
|
A tuple (exit_code, output), where exit_code is None when the command could not start or was stopped for taking too long, and output is its standard output and error, shortened. |