agentlink-sdk 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentlink_sdk-1.0.1/.gitignore +48 -0
- agentlink_sdk-1.0.1/PKG-INFO +107 -0
- agentlink_sdk-1.0.1/README.md +74 -0
- agentlink_sdk-1.0.1/agentlink_sdk/__init__.py +87 -0
- agentlink_sdk-1.0.1/agentlink_sdk/browser.py +617 -0
- agentlink_sdk-1.0.1/agentlink_sdk/client.py +672 -0
- agentlink_sdk-1.0.1/agentlink_sdk/config.py +164 -0
- agentlink_sdk-1.0.1/agentlink_sdk/desktop.py +559 -0
- agentlink_sdk-1.0.1/agentlink_sdk/exceptions.py +86 -0
- agentlink_sdk-1.0.1/agentlink_sdk/logger.py +157 -0
- agentlink_sdk-1.0.1/agentlink_sdk/models/__init__.py +29 -0
- agentlink_sdk-1.0.1/agentlink_sdk/models/results.py +297 -0
- agentlink_sdk-1.0.1/agentlink_sdk/models/sandbox.py +121 -0
- agentlink_sdk-1.0.1/agentlink_sdk/transport/__init__.py +9 -0
- agentlink_sdk-1.0.1/agentlink_sdk/transport/mcp.py +503 -0
- agentlink_sdk-1.0.1/docs/api-reference.md +750 -0
- agentlink_sdk-1.0.1/docs/quickstart.md +177 -0
- agentlink_sdk-1.0.1/examples/_demo_common.py +166 -0
- agentlink_sdk-1.0.1/examples/_env.py +74 -0
- agentlink_sdk-1.0.1/examples/browser_demo.py +121 -0
- agentlink_sdk-1.0.1/examples/windows_demo.py +107 -0
- agentlink_sdk-1.0.1/pyproject.toml +77 -0
- agentlink_sdk-1.0.1/tests/__init__.py +1 -0
- agentlink_sdk-1.0.1/tests/conftest.py +28 -0
- agentlink_sdk-1.0.1/tests/test_client.py +518 -0
- agentlink_sdk-1.0.1/tests/test_config.py +170 -0
- agentlink_sdk-1.0.1/tests/test_exceptions.py +132 -0
- agentlink_sdk-1.0.1/tests/test_models.py +391 -0
- agentlink_sdk-1.0.1/tests/test_transport.py +269 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# git
|
|
2
|
+
**/.git/
|
|
3
|
+
|
|
4
|
+
# idea
|
|
5
|
+
**/.idea/
|
|
6
|
+
*.iml
|
|
7
|
+
*.ipr
|
|
8
|
+
*.iws
|
|
9
|
+
|
|
10
|
+
# eclipse
|
|
11
|
+
**/.settings/
|
|
12
|
+
.classpath
|
|
13
|
+
.project
|
|
14
|
+
|
|
15
|
+
# sts
|
|
16
|
+
**/.sts4-cache/
|
|
17
|
+
|
|
18
|
+
# vscode
|
|
19
|
+
**/.vscode/
|
|
20
|
+
|
|
21
|
+
# maven compile target
|
|
22
|
+
**/target/
|
|
23
|
+
|
|
24
|
+
# uv
|
|
25
|
+
uv.lock
|
|
26
|
+
|
|
27
|
+
# mac os
|
|
28
|
+
.DS_Store
|
|
29
|
+
.cursorrules
|
|
30
|
+
.cursorindexingignore
|
|
31
|
+
|
|
32
|
+
# python
|
|
33
|
+
__pycache__/
|
|
34
|
+
*.py[oc]
|
|
35
|
+
build/
|
|
36
|
+
dist/
|
|
37
|
+
wheels/
|
|
38
|
+
*.egg-info
|
|
39
|
+
.venv/
|
|
40
|
+
*.spec
|
|
41
|
+
.pytest_cache/
|
|
42
|
+
.ruff_cache/
|
|
43
|
+
.coverage
|
|
44
|
+
htmlcov/
|
|
45
|
+
|
|
46
|
+
# runtime
|
|
47
|
+
.env.*
|
|
48
|
+
WinSW.NET461.exe
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentlink-sdk
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Official Python SDK for China Mobile Cloud AgentLink MCP Gateway
|
|
5
|
+
Author-email: China Mobile Cloud AI Team <agentlink@cmss.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: agent,agentlink,automation,browser,cloud,desktop-automation,mcp,rpa,sandbox,windows
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Software Development :: Testing
|
|
21
|
+
Classifier: Topic :: System :: Systems Administration
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Requires-Dist: httpx>=0.24.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest-httpx>=0.21; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
29
|
+
Provides-Extra: docs
|
|
30
|
+
Requires-Dist: mkdocs-material>=9.0; extra == 'docs'
|
|
31
|
+
Requires-Dist: mkdocs>=1.5; extra == 'docs'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# AgentLink SDK
|
|
35
|
+
|
|
36
|
+
**Official Python SDK for China Mobile Cloud AgentLink MCP Gateway**
|
|
37
|
+
|
|
38
|
+
[](https://www.python.org/downloads/)
|
|
39
|
+
[](LICENSE)
|
|
40
|
+
|
|
41
|
+
AgentLink Python SDK provides a high-level, Pythonic API for interacting with the AgentLink MCP (Model Context Protocol) Gateway. It supports cloud sandbox lifecycle management, browser automation, Windows desktop control, and generic MCP tool invocation.
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- ๐ **Browser Automation** โ Navigate, click, type, take screenshots, evaluate JavaScript
|
|
46
|
+
- ๐ฅ๏ธ **Windows Desktop Control** โ PowerShell commands, click, type, keyboard shortcuts, screenshots
|
|
47
|
+
- ๐ **Automatic Sandbox Management** โ Auto-creates and reuses sandbox sessions
|
|
48
|
+
- ๐งต **Thread-Safe** โ Safe for use in multi-threaded applications
|
|
49
|
+
- ๐ **Retry Logic** โ Automatic retries with configurable timeout
|
|
50
|
+
- ๐ฆ **Context Manager** โ Auto-cleanup with `with` statement
|
|
51
|
+
- ๐ **Pythonic API** โ Clean, intuitive interface with type hints
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install agentlink-sdk
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or install from source:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git clone <repo-url>
|
|
63
|
+
cd agentlink-python-sdk
|
|
64
|
+
pip install -e .
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
|
|
69
|
+
### Prerequisites
|
|
70
|
+
|
|
71
|
+
- Python 3.8 or later
|
|
72
|
+
- An AgentLink API key (obtain from your AgentLink platform administrator)
|
|
73
|
+
|
|
74
|
+
### Basic Usage
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from agentlink_sdk import AgentLink
|
|
78
|
+
|
|
79
|
+
# Initialize client
|
|
80
|
+
al = AgentLink(api_key="your-api-key")
|
|
81
|
+
|
|
82
|
+
# Browser automation (sandbox is auto-created and reused)
|
|
83
|
+
al.browser.go("https://www.baidu.com")
|
|
84
|
+
snapshot = al.browser.a11y_tree()
|
|
85
|
+
screenshot = al.browser.capture()
|
|
86
|
+
screenshot.save("page.png")
|
|
87
|
+
|
|
88
|
+
# Clean up
|
|
89
|
+
al.cleanup()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Install for development
|
|
96
|
+
cd agentlink-python-sdk
|
|
97
|
+
pip install -e ".[dev]"
|
|
98
|
+
|
|
99
|
+
# Run tests
|
|
100
|
+
pytest
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
This project is licensed under the Apache License 2.0 โ see the [LICENSE](LICENSE) file for details.
|
|
106
|
+
|
|
107
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# AgentLink SDK
|
|
2
|
+
|
|
3
|
+
**Official Python SDK for China Mobile Cloud AgentLink MCP Gateway**
|
|
4
|
+
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
AgentLink Python SDK provides a high-level, Pythonic API for interacting with the AgentLink MCP (Model Context Protocol) Gateway. It supports cloud sandbox lifecycle management, browser automation, Windows desktop control, and generic MCP tool invocation.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- ๐ **Browser Automation** โ Navigate, click, type, take screenshots, evaluate JavaScript
|
|
13
|
+
- ๐ฅ๏ธ **Windows Desktop Control** โ PowerShell commands, click, type, keyboard shortcuts, screenshots
|
|
14
|
+
- ๐ **Automatic Sandbox Management** โ Auto-creates and reuses sandbox sessions
|
|
15
|
+
- ๐งต **Thread-Safe** โ Safe for use in multi-threaded applications
|
|
16
|
+
- ๐ **Retry Logic** โ Automatic retries with configurable timeout
|
|
17
|
+
- ๐ฆ **Context Manager** โ Auto-cleanup with `with` statement
|
|
18
|
+
- ๐ **Pythonic API** โ Clean, intuitive interface with type hints
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install agentlink-sdk
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or install from source:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git clone <repo-url>
|
|
30
|
+
cd agentlink-python-sdk
|
|
31
|
+
pip install -e .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
### Prerequisites
|
|
37
|
+
|
|
38
|
+
- Python 3.8 or later
|
|
39
|
+
- An AgentLink API key (obtain from your AgentLink platform administrator)
|
|
40
|
+
|
|
41
|
+
### Basic Usage
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from agentlink_sdk import AgentLink
|
|
45
|
+
|
|
46
|
+
# Initialize client
|
|
47
|
+
al = AgentLink(api_key="your-api-key")
|
|
48
|
+
|
|
49
|
+
# Browser automation (sandbox is auto-created and reused)
|
|
50
|
+
al.browser.go("https://www.baidu.com")
|
|
51
|
+
snapshot = al.browser.a11y_tree()
|
|
52
|
+
screenshot = al.browser.capture()
|
|
53
|
+
screenshot.save("page.png")
|
|
54
|
+
|
|
55
|
+
# Clean up
|
|
56
|
+
al.cleanup()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Development
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Install for development
|
|
63
|
+
cd agentlink-python-sdk
|
|
64
|
+
pip install -e ".[dev]"
|
|
65
|
+
|
|
66
|
+
# Run tests
|
|
67
|
+
pytest
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
This project is licensed under the Apache License 2.0 โ see the [LICENSE](LICENSE) file for details.
|
|
73
|
+
|
|
74
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AgentLink Python SDK
|
|
3
|
+
|
|
4
|
+
Official Python SDK for China Mobile Cloud AgentLink MCP Gateway.
|
|
5
|
+
Provides sandbox lifecycle management, browser automation, desktop control,
|
|
6
|
+
and tool invocation capabilities.
|
|
7
|
+
|
|
8
|
+
Usage::
|
|
9
|
+
|
|
10
|
+
from agentlink_sdk import AgentLink
|
|
11
|
+
|
|
12
|
+
al = AgentLink(api_key="your-api-key")
|
|
13
|
+
|
|
14
|
+
# Browser automation
|
|
15
|
+
al.browser.go("https://www.baidu.com")
|
|
16
|
+
shot = al.browser.capture()
|
|
17
|
+
shot.save("page.png")
|
|
18
|
+
|
|
19
|
+
# Windows desktop control
|
|
20
|
+
al.desktop.shell("Get-Date")
|
|
21
|
+
al.desktop.capture().save("desktop.png")
|
|
22
|
+
|
|
23
|
+
# Clean up
|
|
24
|
+
al.cleanup()
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
__version__ = "1.0.0"
|
|
28
|
+
|
|
29
|
+
from .client import AgentLink
|
|
30
|
+
from .browser import BrowserController
|
|
31
|
+
from .desktop import DesktopController
|
|
32
|
+
from .config import AgentLinkConfig
|
|
33
|
+
from .models.sandbox import SandboxSession, SandboxType, IMAGE_BROWSER, IMAGE_WINDOWS
|
|
34
|
+
from .models.results import (
|
|
35
|
+
ActionResult,
|
|
36
|
+
Screenshot,
|
|
37
|
+
SandboxResult,
|
|
38
|
+
ToolResult,
|
|
39
|
+
)
|
|
40
|
+
from .exceptions import (
|
|
41
|
+
AgentLinkError,
|
|
42
|
+
AgentLinkTimeoutError,
|
|
43
|
+
ConfigurationError,
|
|
44
|
+
SandboxError,
|
|
45
|
+
ToolCallError,
|
|
46
|
+
SessionError,
|
|
47
|
+
TransportError,
|
|
48
|
+
TimeoutError,
|
|
49
|
+
BrowserError,
|
|
50
|
+
CommandError,
|
|
51
|
+
FileSystemError,
|
|
52
|
+
)
|
|
53
|
+
from .logger import set_log_level
|
|
54
|
+
|
|
55
|
+
__all__ = [
|
|
56
|
+
"__version__",
|
|
57
|
+
# Client & controllers
|
|
58
|
+
"AgentLink",
|
|
59
|
+
"BrowserController",
|
|
60
|
+
"DesktopController",
|
|
61
|
+
# Config
|
|
62
|
+
"AgentLinkConfig",
|
|
63
|
+
# Models
|
|
64
|
+
"SandboxSession",
|
|
65
|
+
"SandboxType",
|
|
66
|
+
"IMAGE_BROWSER",
|
|
67
|
+
"IMAGE_WINDOWS",
|
|
68
|
+
# Results
|
|
69
|
+
"ActionResult",
|
|
70
|
+
"Screenshot",
|
|
71
|
+
"SandboxResult",
|
|
72
|
+
"ToolResult",
|
|
73
|
+
# Exceptions
|
|
74
|
+
"AgentLinkError",
|
|
75
|
+
"ConfigurationError",
|
|
76
|
+
"SandboxError",
|
|
77
|
+
"ToolCallError",
|
|
78
|
+
"SessionError",
|
|
79
|
+
"TransportError",
|
|
80
|
+
"AgentLinkTimeoutError",
|
|
81
|
+
"TimeoutError",
|
|
82
|
+
"BrowserError",
|
|
83
|
+
"CommandError",
|
|
84
|
+
"FileSystemError",
|
|
85
|
+
# Utilities
|
|
86
|
+
"set_log_level",
|
|
87
|
+
]
|