CommandSessionTask
Execute commands in a stateful, interactive terminal session. Maintains environment persistence, supports TTY allocation, and manages long-running process lifecycles.
Category: Session
Stateful
TTY Supported
ExecutionConfig.json
JSON
{
"command": ["bash", "-i"],
"inputs": [
"export PROJECT=Cognotik",
"ls -la",
"echo $PROJECT"
],
"sessionId": "dev-shell-01",
"tty": true
}
→
Session UI Output
Rendered Markdown
### Input 2
$ ls -la
Output:
total 24
drwxr-xr-x 4 user staff 128 May 20 10:00 .
drwxr-xr-x 8 user staff 256 May 20 09:45 ..
-rw-r--r-- 1 user staff 1024 May 20 10:00 README.md
Execution Configuration
| Field | Type | Description |
|---|---|---|
command |
List<String> |
The command to start the interactive session. Defaults to ["bash", "-i"]. |
inputs |
List<String> |
Sequential commands to send to the session's standard input. |
sessionId |
String? |
Optional ID to reuse an existing session. Enables state persistence across multiple task executions. |
timeout |
Long |
Maximum time (ms) for commands to finish. Default: 30000. |
idle_timeout |
Long |
Maximum time (ms) to wait for output after a command. Default: 2000. |
tty |
Boolean |
If true, uses pty4j to allocate a pseudo-terminal. Required for TTY-aware applications. |