Appearance
AGB SDK Examples
Practical, runnable examples demonstrating the capabilities of the AGB SDK.
Example Catalog
| Category | Example | Description |
|---|---|---|
| Start Here | Session Management | Create, retrieve, and manage session lifecycle. |
| Code Execution | Run Python, JavaScript, Java, and R code. | |
| Command Execution | Execute shell commands and system tools. | |
| File Operations | Read, write, upload, and manage files in the cloud. | |
| Browser | Basic Navigation | Open URLs, click buttons, and take screenshots. |
| Data Extraction | Extract structured data from web pages using AI. | |
| Browser Examples | Full list of browser automation examples. | |
| Advanced | Browser Extensions | Load and manage Chrome extensions in your sessions. |
| Context Sync | Sync local context to remote sessions. | |
| Directory Monitoring | Watch for file changes in real-time. |
How to Run
Install the SDK:
bashpip install agbcloud-sdkSet your API Key:
bashexport AGB_API_KEY="your_api_key_here"Run a script:
bash# Run from the project root python docs/examples/session_management/create_session.py
Key Concepts Demonstrated
- Session Lifecycle: All examples show proper
create->use->deletepatterns. - Error Handling: Check
result.successand handleresult.error_message. - Resource Management: Use
try...finallyblocks to ensure sessions are cleaned up.
Troubleshooting
- Authentication Error: Double-check your
AGB_API_KEY. - Image ID Error: Ensure you are using a valid
image_id(e.g.,agb-code-space-1oragb-browser-use-1). - Timeout Error: Some operations might take longer depending on network conditions; try increasing timeout values.
Contributing
Have a useful example? We'd love to include it! Please ensure your example is:
- Self-contained: Runnable without external dependencies.
- Well-documented: Clear comments and explanations.
- Error-handled: Proper error checking and cleanup.