Python SDK for AgentBay service
Project description
AgentBay SDK for Python
Execute commands, operate files, and run code in cloud environments
📦 Installation
pip install wuying-agentbay-sdk
🚀 Prerequisites
Before using the SDK, you need to:
- Register an Alibaba Cloud account: https://aliyun.com
- Get API credentials: AgentBay Console
- Set environment variable:
export AGENTBAY_API_KEY=your_api_key
🚀 Quick Start
from agentbay import AgentBay
# Create session
agent_bay = AgentBay()
result = agent_bay.create()
if result.success:
session = result.session
# Execute command
cmd_result = session.command.execute_command("ls -la")
print(cmd_result.output)
# File operations
session.file_system.write_file("/tmp/test.txt", "Hello World")
content = session.file_system.read_file("/tmp/test.txt")
print(content.content)
📖 Complete Documentation
🆕 New Users
- 📚 Quick Start Tutorial - Get started in 5 minutes
- 🎯 Core Concepts - Understand cloud environments and sessions
- 💡 Best Practices - Common patterns and tips
🚀 Experienced Users
- 📖 Feature Guides - Complete feature introduction
- 🔧 Python API Reference - Detailed API documentation
- 💻 Python Examples - Complete example code
🆘 Need Help
- ❓ FAQ - Quick answers
- 🔧 Troubleshooting - Problem diagnosis
🔧 Core Features Quick Reference
Session Management
# Create session
result = agent_bay.create()
if result.success:
session = result.session
# List sessions
sessions = agent_bay.list()
# Connect to existing session
session = agent_bay.connect("session_id")
File Operations
# Read/write files
session.file_system.write_file("/path/file.txt", "content")
content = session.file_system.read_file("/path/file.txt")
# List directory
files = session.file_system.list_directory("/path")
Command Execution
# Execute command
result = session.command.execute_command("python script.py")
print(result.output)
Data Persistence
# Create context
context = agent_bay.context.get("my-project", create=True).context
# Create session with context
from agentbay.session_params import CreateSessionParams
from agentbay.context_sync import ContextSync, SyncPolicy
context_sync = ContextSync.new(context.id, "/mnt/data", SyncPolicy.default())
session = agent_bay.create(CreateSessionParams(context_syncs=[context_sync])).session
🆘 Get Help
📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wuying_agentbay_sdk-0.6.1.tar.gz
(59.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wuying_agentbay_sdk-0.6.1.tar.gz.
File metadata
- Download URL: wuying_agentbay_sdk-0.6.1.tar.gz
- Upload date:
- Size: 59.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
747038d28c938b3ffd025d78945c6d8e0170f8bf938134800329e6a76c9024f9
|
|
| MD5 |
9b7a608653dfaf46eb04f321b05ee86e
|
|
| BLAKE2b-256 |
23732a2b9707e606a6e95236fba6b6f0e979183417eb1c9b7d664900bfaaf1ec
|
File details
Details for the file wuying_agentbay_sdk-0.6.1-py3-none-any.whl.
File metadata
- Download URL: wuying_agentbay_sdk-0.6.1-py3-none-any.whl
- Upload date:
- Size: 106.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8641b685e8c8f62bd60fd64769b45b4e401f85a2d436afb9099d42ad8faf0df7
|
|
| MD5 |
fa88f65f7c67ecfc2d1123adce7ce798
|
|
| BLAKE2b-256 |
b696cd20f9e19fa31345ea907ea50bcb87f591d0b3ae69e744a1527f39e9a34a
|