AgentRun CLI
Use agentrun when direct command execution would be too noisy or risky because the process can hang, flood output, or return unstructured results.
Invoke the Tool
Prefer the installed binary when it exists:
agentrun -timeout 5s -- sh -c 'echo ok'
If working inside this repository or the binary is not installed, run:
go run ./cmd/agentrun -- -timeout 5s -- sh -c 'echo ok'
Choose Flags
- Use
-timeoutto cap command duration. - Use
-max-outputto cap captured stdout and stderr bytes. - Use
-dirwhen the command must run in a specific directory. - Use
-stdinonly if the child process must read caller input. - Use
-format jsonor-format yamlfor programmatic consumers. - Use
-format textfor quick inspection.
Apply Good Defaults
- Keep short timeouts for probes and readiness checks.
- Keep small output caps for logs and diagnostic commands.
- Prefer
agentrunover rawsh -cwhen the result needs to be parsed later.
Examples
Run a health check:
go run ./cmd/agentrun -- -timeout 3s -format json -- sh -c 'uptime && df -h'
Capture a bounded log sample:
go run ./cmd/agentrun -- -timeout 2s -max-output 4096 -- journalctl -n 100