OT Direct¶
Manage the onetool execution host from within a tool session.
Short alias: direct
Highlights¶
- Start, stop, and restart the local HTTP execution host
- Check host status and uptime
- Tail the execution host log
- Works alongside the
onetool directCLI — both manage the same host
Functions¶
| Function | Description |
|---|---|
ot_direct.stop(port) |
Stop the running host |
ot_direct.status(port) |
Show host status (PID, uptime, log path) |
ot_direct.restart(config, port) |
Stop and restart, reusing saved config |
ot_direct.logs(port, lines) |
Return the last N lines of the host log |
Key Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
config |
str | None |
Path to onetool.yaml; host starts with no tools if omitted |
secrets |
str | None |
Path to secrets file (optional) |
port |
int | 8765 |
Port the host listens on |
lines |
int | 50 |
Number of log lines to return (logs() only) |
Configuration¶
Required¶
- No required
tools.ot_directsettings.
Optional¶
- This pack does not define any pack-specific keys under
tools.ot_direct. - The default port (
8765) can be overridden per-call with theportparameter.
Examples¶
Check status and tail the log¶
Restart after config changes¶
Tail the log¶
Multiple hosts on different ports¶
ot_direct.start(config='project-a.yaml', port=8765)
ot_direct.start(config='project-b.yaml', port=9000)
ot_direct.status(port=8765)
ot_direct.status(port=9000)
ot_direct.stop(port=9000)
Notes¶
restart()inherits the savedconfigandsecretsfrom the previous CLIonetool direct start— pass them explicitly to override; spins up a fresh host if none is running- The same PID and log files used by
onetool direct startare used here (~/.onetool/direct-server-{port}.pidand.log) - Use
onetool directCLI for interactive use; useot_directwhen driving the host from within a tool session