wuying-agentbay-sdk


Namewuying-agentbay-sdk JSON
Version 0.5.2 PyPI version JSON
download
home_pagehttps://github.com/aliyun/wuying-agentbay-sdk
SummaryPython SDK for AgentBay service
upload_time2025-08-15 07:34:47
maintainerNone
docs_urlNone
authorAlibaba Cloud
requires_python>=3.7
licenseNone
keywords alibaba aliyun wuying agentbay sdk cloud api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python SDK for Wuying AgentBay

This directory contains the Python implementation of the Wuying AgentBay SDK.

## Prerequisites

- Python 3.10 or later
- Poetry (for development)

## Installation

### For Development

Clone the repository and install dependencies using Poetry:

```bash
git clone https://github.com/aliyun/wuying-agentbay-sdk.git
cd wuying-agentbay-sdk/python
poetry install
```

### For Usage in Your Project

```bash
pip install wuying-agentbay-sdk
```

## Running Examples

You can find examples in the `docs/examples/python` directory, including:

- Basic SDK usage
- Context management
- Label management
- Mobile system integration
- OSS management
- File system operations
- Session creation

To run the examples:

```bash
# Using Poetry
poetry run python docs/examples/python/basic_usage.py

# Or directly with Python if installed in your environment
python docs/examples/python/basic_usage.py
```

## Python-Specific Usage

```python
from agentbay import AgentBay
from agentbay.exceptions import AgentBayError
from agentbay.session_params import CreateSessionParams

def main():
    # Initialize with API key
    api_key = "your_api_key"  # Or use os.environ.get("AGENTBAY_API_KEY")

    try:
        agent_bay = AgentBay(api_key=api_key)

        # Create a session with labels
        params = CreateSessionParams()
        params.labels = {
            "purpose": "demo",
            "environment": "development"
        }
        session_result = agent_bay.create(params)
        session = session_result.session
        
        # Execute a command
        cmd_result = session.command.execute_command("ls -la")
        
        # Read a file
        file_result = session.file_system.read_file("/path/to/file.txt")
        
        # Run code
        code_result = session.code.run_code("print('Hello, World!')", "python")
        
        # Application management
        apps_result = session.application.get_installed_apps(
            include_system_apps=True,
            include_store_apps=False,
            include_desktop_apps=True
        )
        
        # Window management
        windows_result = session.window.list_root_windows()
        window_result = session.window.get_active_window()
        
        # UI interactions
        screenshot_result = session.ui.screenshot()
        session.ui.send_key(3)  # Send HOME key
        
        # OSS operations
        upload_result = session.oss.upload_file("/local/path/file.txt", "remote/path/")
        
        # Context management
        contexts_result = agent_bay.context.list()
        
        # Session labels
        labels_result = session.get_labels()
        
        # Clean up
        delete_result = agent_bay.delete(session)

    except AgentBayError as e:
        print(f"Error: {e}")
```

## Key Features

### Session Management

- Create sessions with optional parameters (image_id, context_id, labels)
- List sessions with pagination and filtering by labels
- Delete sessions and clean up resources
- Manage session labels
- Get session information and links

### Command Execution

- Execute shell commands
- Run code in various languages
- Get command output and execution status

### File System Operations

- Read and write files
- List directory contents
- Create and delete files and directories
- Get file information

### UI Interaction

- Take screenshots
- Find UI elements by criteria
- Click on UI elements
- Send text input
- Perform swipe gestures
- Send key events (HOME, BACK, MENU, etc.)

### Application Management

- Get installed applications
- List running applications
- Start and stop applications
- Get application information

### Window Management

- List windows
- Get active window
- Focus, resize, and move windows
- Get window properties

### Context Management

- Create, list, and delete contexts
- Bind sessions to contexts
- Synchronize context data using policies
- Get context information

### OSS Integration

- Upload files to OSS
- Download files from OSS
- Initialize OSS environment

### Mobile System Support

- Special UI interactions for mobile environments
- Support for mobile application management
- Touch and gesture simulation

## Response Format

All API methods return responses that include:

- `request_id`: A unique identifier for the request
- `success`: A boolean indicating whether the operation was successful
- Operation-specific data (varies by method)
- `error_message`: Error details if the operation failed

## Development

### Building the SDK

```bash
poetry build
```

### Running Tests

```bash
poetry run pytest
```

For more detailed documentation, refer to the [SDK Documentation](../docs/README.md).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aliyun/wuying-agentbay-sdk",
    "name": "wuying-agentbay-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "alibaba, aliyun, wuying, agentbay, sdk, cloud, api",
    "author": "Alibaba Cloud",
    "author_email": "wuying@alibaba-inc.com",
    "download_url": "https://files.pythonhosted.org/packages/a5/43/14fbdfa7a51a6cb9d76b65b14fd9157685db0459a74b88f6c6770bc1e1c8/wuying_agentbay_sdk-0.5.2.tar.gz",
    "platform": null,
    "description": "# Python SDK for Wuying AgentBay\n\nThis directory contains the Python implementation of the Wuying AgentBay SDK.\n\n## Prerequisites\n\n- Python 3.10 or later\n- Poetry (for development)\n\n## Installation\n\n### For Development\n\nClone the repository and install dependencies using Poetry:\n\n```bash\ngit clone https://github.com/aliyun/wuying-agentbay-sdk.git\ncd wuying-agentbay-sdk/python\npoetry install\n```\n\n### For Usage in Your Project\n\n```bash\npip install wuying-agentbay-sdk\n```\n\n## Running Examples\n\nYou can find examples in the `docs/examples/python` directory, including:\n\n- Basic SDK usage\n- Context management\n- Label management\n- Mobile system integration\n- OSS management\n- File system operations\n- Session creation\n\nTo run the examples:\n\n```bash\n# Using Poetry\npoetry run python docs/examples/python/basic_usage.py\n\n# Or directly with Python if installed in your environment\npython docs/examples/python/basic_usage.py\n```\n\n## Python-Specific Usage\n\n```python\nfrom agentbay import AgentBay\nfrom agentbay.exceptions import AgentBayError\nfrom agentbay.session_params import CreateSessionParams\n\ndef main():\n    # Initialize with API key\n    api_key = \"your_api_key\"  # Or use os.environ.get(\"AGENTBAY_API_KEY\")\n\n    try:\n        agent_bay = AgentBay(api_key=api_key)\n\n        # Create a session with labels\n        params = CreateSessionParams()\n        params.labels = {\n            \"purpose\": \"demo\",\n            \"environment\": \"development\"\n        }\n        session_result = agent_bay.create(params)\n        session = session_result.session\n        \n        # Execute a command\n        cmd_result = session.command.execute_command(\"ls -la\")\n        \n        # Read a file\n        file_result = session.file_system.read_file(\"/path/to/file.txt\")\n        \n        # Run code\n        code_result = session.code.run_code(\"print('Hello, World!')\", \"python\")\n        \n        # Application management\n        apps_result = session.application.get_installed_apps(\n            include_system_apps=True,\n            include_store_apps=False,\n            include_desktop_apps=True\n        )\n        \n        # Window management\n        windows_result = session.window.list_root_windows()\n        window_result = session.window.get_active_window()\n        \n        # UI interactions\n        screenshot_result = session.ui.screenshot()\n        session.ui.send_key(3)  # Send HOME key\n        \n        # OSS operations\n        upload_result = session.oss.upload_file(\"/local/path/file.txt\", \"remote/path/\")\n        \n        # Context management\n        contexts_result = agent_bay.context.list()\n        \n        # Session labels\n        labels_result = session.get_labels()\n        \n        # Clean up\n        delete_result = agent_bay.delete(session)\n\n    except AgentBayError as e:\n        print(f\"Error: {e}\")\n```\n\n## Key Features\n\n### Session Management\n\n- Create sessions with optional parameters (image_id, context_id, labels)\n- List sessions with pagination and filtering by labels\n- Delete sessions and clean up resources\n- Manage session labels\n- Get session information and links\n\n### Command Execution\n\n- Execute shell commands\n- Run code in various languages\n- Get command output and execution status\n\n### File System Operations\n\n- Read and write files\n- List directory contents\n- Create and delete files and directories\n- Get file information\n\n### UI Interaction\n\n- Take screenshots\n- Find UI elements by criteria\n- Click on UI elements\n- Send text input\n- Perform swipe gestures\n- Send key events (HOME, BACK, MENU, etc.)\n\n### Application Management\n\n- Get installed applications\n- List running applications\n- Start and stop applications\n- Get application information\n\n### Window Management\n\n- List windows\n- Get active window\n- Focus, resize, and move windows\n- Get window properties\n\n### Context Management\n\n- Create, list, and delete contexts\n- Bind sessions to contexts\n- Synchronize context data using policies\n- Get context information\n\n### OSS Integration\n\n- Upload files to OSS\n- Download files from OSS\n- Initialize OSS environment\n\n### Mobile System Support\n\n- Special UI interactions for mobile environments\n- Support for mobile application management\n- Touch and gesture simulation\n\n## Response Format\n\nAll API methods return responses that include:\n\n- `request_id`: A unique identifier for the request\n- `success`: A boolean indicating whether the operation was successful\n- Operation-specific data (varies by method)\n- `error_message`: Error details if the operation failed\n\n## Development\n\n### Building the SDK\n\n```bash\npoetry build\n```\n\n### Running Tests\n\n```bash\npoetry run pytest\n```\n\nFor more detailed documentation, refer to the [SDK Documentation](../docs/README.md).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python SDK for AgentBay service",
    "version": "0.5.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/aliyun/wuying-agentbay-sdk/issues",
        "Documentation": "https://github.com/aliyun/wuying-agentbay-sdk/blob/main/README.md",
        "Homepage": "https://github.com/aliyun/wuying-agentbay-sdk",
        "Source Code": "https://github.com/aliyun/wuying-agentbay-sdk"
    },
    "split_keywords": [
        "alibaba",
        " aliyun",
        " wuying",
        " agentbay",
        " sdk",
        " cloud",
        " api"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1b37e340135253e5c076f965a7b6b39c078b28c6854f450d00b2769038546f2d",
                "md5": "6b95c706a6faa11c56c262dc6c3ab101",
                "sha256": "ce4c185f297e8a067586cc0514f53ab3d8787b29292a3009fc4f94c35259b42e"
            },
            "downloads": -1,
            "filename": "wuying_agentbay_sdk-0.5.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6b95c706a6faa11c56c262dc6c3ab101",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 92742,
            "upload_time": "2025-08-15T07:34:46",
            "upload_time_iso_8601": "2025-08-15T07:34:46.063833Z",
            "url": "https://files.pythonhosted.org/packages/1b/37/e340135253e5c076f965a7b6b39c078b28c6854f450d00b2769038546f2d/wuying_agentbay_sdk-0.5.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a54314fbdfa7a51a6cb9d76b65b14fd9157685db0459a74b88f6c6770bc1e1c8",
                "md5": "130a5b3a7a8d2c40409ae7750cfa09c5",
                "sha256": "0d55d39fad95eb395666c6f576a62fcf9a8978b47f346a53a66d3c8e64a91379"
            },
            "downloads": -1,
            "filename": "wuying_agentbay_sdk-0.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "130a5b3a7a8d2c40409ae7750cfa09c5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 54781,
            "upload_time": "2025-08-15T07:34:47",
            "upload_time_iso_8601": "2025-08-15T07:34:47.652796Z",
            "url": "https://files.pythonhosted.org/packages/a5/43/14fbdfa7a51a6cb9d76b65b14fd9157685db0459a74b88f6c6770bc1e1c8/wuying_agentbay_sdk-0.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-15 07:34:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aliyun",
    "github_project": "wuying-agentbay-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "wuying-agentbay-sdk"
}
        
Elapsed time: 0.65312s