Appearance
Command API Reference
⚡ Related Tutorial
- Command Execution Guide - Learn how to execute commands in sessions
Overview
The Command module provides methods for executing shell commands within a session in the AGB cloud environment. It supports command execution with configurable timeouts.
CommandResult
python
class CommandResult(ApiResponse)Result of command execution operations.
Command
python
class Command(BaseService)Handles command execution operations in the AGB cloud environment.
execute_command
python
def execute_command(command: str, timeout_ms: int = 1000) -> CommandResultExecute a command in the cloud environment with a specified timeout.
Arguments:
commandstr - The command to execute.timeout_msint - The timeout for the command execution in milliseconds. Defaults to 1000.
Returns:
CommandResult: Result object containing success status, command output,
and error message if any.
Best Practices
- Always specify appropriate timeout values based on expected command duration
- Handle command execution errors gracefully
- Use absolute paths when referencing files in commands
- Be aware that commands run with session user permissions
- Clean up temporary files created by commands
Related Resources
Documentation generated automatically from source code using pydoc-markdown.