Skip to main content

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:

  1. Register an Alibaba Cloud account: https://aliyun.com
  2. Get API credentials: AgentBay Console
  3. 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

🚀 Experienced Users

🆘 Need Help

🔧 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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wuying_agentbay_sdk-0.6.1-py3-none-any.whl (106.3 kB view details)

Uploaded Python 3

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

Hashes for wuying_agentbay_sdk-0.6.1.tar.gz
Algorithm Hash digest
SHA256 747038d28c938b3ffd025d78945c6d8e0170f8bf938134800329e6a76c9024f9
MD5 9b7a608653dfaf46eb04f321b05ee86e
BLAKE2b-256 23732a2b9707e606a6e95236fba6b6f0e979183417eb1c9b7d664900bfaaf1ec

See more details on using hashes here.

File details

Details for the file wuying_agentbay_sdk-0.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for wuying_agentbay_sdk-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8641b685e8c8f62bd60fd64769b45b4e401f85a2d436afb9099d42ad8faf0df7
MD5 fa88f65f7c67ecfc2d1123adce7ce798
BLAKE2b-256 b696cd20f9e19fa31345ea907ea50bcb87f591d0b3ae69e744a1527f39e9a34a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page