Skip to main content

Execution Tools

Category: execution · 6 tools

Run commands, manage processes, and automate tasks.

Tools

ToolParametersDescription
exec.runcommand, cwd?, timeout?Execute a command and return output
exec.run_shellcommand, cwd?, timeout?Execute through shell (supports pipes, redirects)
exec.run_backgroundcommand, cwd?Start a background process
exec.read_outputprocess_idRead stdout/stderr from background process
exec.killprocess_idKill a running process
exec.list_processes-List managed background processes

Examples

Running Commands

// AI uses exec.run or exec.run_shell
const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Run the tests' }],
model: 'gpt-4o',
});

Background Processes

// AI starts a dev server in background
const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Start the development server' }],
model: 'gpt-4o',
});

Shell Commands

// AI uses exec.run_shell for pipes
const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Count the lines of TypeScript code' }],
model: 'gpt-4o',
});
// AI might run: find . -name "*.ts" | xargs wc -l

Security Note

Execution tools are powerful and potentially dangerous. Use modes to restrict access:

const safeMode: ModeConfig = {
name: 'no-exec',
displayName: 'No Execution',
description: 'No command execution',
systemPrompt: '...',
allowedToolCategories: [],
blockedToolCategories: ['execution'],
allowedTools: [],
blockedTools: [],
blockAllTools: false,
};