You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sdk/agent_tools.mdx
+77-39Lines changed: 77 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -330,39 +330,44 @@ command(
330
330
timeout: int=120,
331
331
cwd: str|None=None,
332
332
env: dict[str, str] |None=None,
333
+
input: str|None=None,
333
334
) ->str
334
335
```
335
336
336
337
Execute a shell command.
337
338
338
-
Use this tool to run system utilities and command-line programs (e.g., `ls`, `cat`, `grep`). It is designed for straightforward, single-shot operations and returns the combined output and error streams.
339
-
340
339
**Best Practices**
341
340
342
-
* Argument Format: The command and its arguments *must* be provided as a list of strings (e.g., `["ls", "-la", "/tmp"]`), not as a single string.
343
-
* No Shell Syntax: Does not use a shell. Features like pipes (`|`), redirection (`>`), and variable expansion (`$VAR`) are not supported.
344
-
* Error on Failure: The tool will raise a `RuntimeError` if the command returns a non-zero exit code.
341
+
* Argument Format: Command and arguments must be a list of strings.
342
+
* No Shell Syntax: Does not use a shell (no pipes, redirection, var expansion, etc.).
343
+
* Error on Failure: Raises RuntimeError for non-zero exit codes.
344
+
* Use input Parameter: Send data to the command's standard input to avoid hanging.
345
345
346
346
**Parameters:**
347
347
348
348
***`cmd`**
349
349
(`list[str]`)
350
-
–The command to execute, provided as a list of strings.
350
+
–The command to execute as a list of strings.
351
351
***`timeout`**
352
352
(`int`, default:
353
353
`120`
354
354
)
355
-
–Maximum time in seconds to allow for command execution.
355
+
–Maximum execution time in seconds.
356
356
***`cwd`**
357
357
(`str | None`, default:
358
358
`None`
359
359
)
360
-
–The working directory in which to execute the command.
360
+
–The working directory for the command.
361
361
***`env`**
362
362
(`dict[str, str] | None`, default:
363
363
`None`
364
364
)
365
-
–Optional environment variables to set for the command.
365
+
–Environment variables for the command.
366
+
***`input`**
367
+
(`str | None`, default:
368
+
`None`
369
+
)
370
+
–Optional string to send to the command's standard input.
366
371
367
372
<Accordiontitle="Source code in dreadnode/agent/tools/execute.py"icon="code">
368
373
```python
@@ -373,52 +378,85 @@ async def command(
373
378
timeout: int=120,
374
379
cwd: str|None=None,
375
380
env: dict[str, str] |None=None,
381
+
input: str|None=None,
376
382
) -> str:
377
383
"""
378
384
Execute a shell command.
379
385
380
-
Use this tool to run system utilities and command-line programs (e.g., `ls`, `cat`, `grep`). \
381
-
It is designed for straightforward, single-shot operations and returns the combined output and error streams.
382
-
383
386
## Best Practices
384
-
- Argument Format: The command and its arguments *must* be provided as a \
385
-
list of strings (e.g., `["ls", "-la", "/tmp"]`), not as a single string.
386
-
- No Shell Syntax: Does not use a shell. Features like pipes (`|`), \
387
-
redirection (`>`), and variable expansion (`$VAR`) are not supported.
388
-
- Error on Failure: The tool will raise a `RuntimeError` if the command returns a non-zero exit code.
387
+
- Argument Format: Command and arguments must be a list of strings.
388
+
- No Shell Syntax: Does not use a shell (no pipes, redirection, var expansion, etc.).
389
+
- Error on Failure: Raises RuntimeError for non-zero exit codes.
390
+
- Use input Parameter: Send data to the command's standard input to avoid hanging.
389
391
390
392
Args:
391
-
cmd: The command to execute, provided as a list of strings.
392
-
timeout: Maximum time in seconds to allow for command execution.
393
-
cwd: The working directory in which to execute the command.
394
-
env: Optional environment variables to set for the command.
393
+
cmd: The command to execute as a list of strings.
394
+
timeout: Maximum execution time in seconds.
395
+
cwd: The working directory for the command.
396
+
env: Environment variables for the command.
397
+
input: Optional string to send to the command's standard input.
0 commit comments