Skip to main content

Method signature

Parameters

Options Object

StreamCallbacks Interface

Return value

AgentResponse Interface

Examples

Basic Command Execution

Command with Timeout

Background Command Execution

Streaming Command Output

Streaming with Callbacks (Legacy)

Command with Branch Switching

Complex Command with All Options

Error handling

The method throws errors in the following cases:
  • Sandbox not available: When no active sandbox environment exists
  • Command timeout: When the command exceeds the specified timeout
  • Invalid command: When the command syntax is invalid or command not found
  • Permission errors: When the command requires elevated permissions not available in the sandbox
  • Resource limitations: When the command exceeds sandbox resource limits

Security considerations

  • Commands are executed within a sandboxed environment for security
  • Elevated privileges (sudo) may not be available depending on sandbox configuration
  • File system access is limited to the sandbox environment
  • Network access may be restricted based on sandbox configuration

Notes

  • Sandbox Environment: Commands are executed within the active sandbox environment
  • Working Directory: Commands execute in the sandbox’s default working directory
  • Branch Support: Automatically switches to the specified branch (creates if it doesn’t exist)
  • Environment Variables: Sandbox environment variables are available to executed commands
  • Resource Limits: Commands are subject to sandbox CPU, memory, and time limitations
  • Background Execution: Background commands continue running after the method returns
  • Streaming Support: Real-time output streaming is available through stdout/stderr events or callbacks
  • Exit Codes: Standard Unix exit codes apply (0 = success, non-zero = error)
  • Event Handling: Prefer using vibekit.on('stdout') and vibekit.on('stderr') over callback options