smooth-py 0.4.0.post2.dev20260122__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.
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.3
2
+ Name: smooth-py
3
+ Version: 0.4.0.post2.dev20260122
4
+ Summary:
5
+ Author: Luca Pinchetti
6
+ Author-email: luca@circlemind.co
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Provides-Extra: mcp
14
+ Requires-Dist: aiohttp (>=3.9.0,<4.0.0)
15
+ Requires-Dist: deprecated (>=1.2.18,<2.0.0)
16
+ Requires-Dist: fastmcp (>=2.12.0,<3.0.0) ; extra == "mcp"
17
+ Requires-Dist: nanoid (>=2.0.0,<3.0.0)
18
+ Requires-Dist: pydantic (>=2.11.7,<3.0.0)
19
+ Description-Content-Type: text/markdown
20
+
21
+ # Smooth Python SDK
22
+
23
+ The Smooth Python SDK provides a convenient way to interact with the Smooth API for programmatic browser automation and task execution.
24
+
25
+ ## Features
26
+
27
+ * **Synchronous and Asynchronous Clients**: Choose between `SmoothClient` for traditional sequential programming and `SmoothAsyncClient` for high-performance asynchronous applications.
28
+ * **Task Management**: Easily run tasks and retrieve results upon completion.
29
+ * **Interactive Browser Sessions**: Get access to, interact with, and delete stateful browser sessions to manage your login credentials.
30
+ * **Advanced Task Configuration**: Customize task execution with options for device type, session recording, stealth mode, and proxy settings.
31
+ * **🆕 MCP Server**: Use the included Model Context Protocol server to integrate browser automation with AI assistants like Claude Desktop.
32
+
33
+ ## Installation
34
+
35
+ You can install the Smooth Python SDK using pip:
36
+
37
+ ```bash
38
+ pip install smooth-py
39
+ ```
40
+
41
+ ## Quick Start Options
42
+
43
+ ### Option 1: Direct SDK Usage
44
+
45
+ Use the SDK directly in your Python applications:
46
+
47
+ ### Option 2: MCP Server (AI Assistant Integration)
48
+
49
+ Use the included MCP server to integrate browser automation with AI assistants:
50
+
51
+ #### Installation
52
+ ```bash
53
+ # Install with MCP support
54
+ pip install smooth-py[mcp]
55
+ ```
56
+
57
+ #### Basic Usage
58
+ ```python
59
+ from smooth.mcp import SmoothMCP
60
+
61
+ # Create and run the MCP server
62
+ mcp = SmoothMCP(api_key="your-api-key")
63
+ mcp.run() # STDIO transport for Claude Desktop
64
+
65
+ # Or with HTTP transport for web deployment
66
+ mcp.run(transport="http", host="0.0.0.0", port=8000)
67
+ ```
68
+
69
+ #### Standalone Script (Backward Compatible)
70
+ ```bash
71
+ # Set your API key
72
+ export CIRCLEMIND_API_KEY="your-api-key-here"
73
+
74
+ # Run the MCP server
75
+ python mcp_server.py
76
+ ```
77
+
78
+ Then configure your AI assistant (like Claude Desktop) to use the MCP server. See [MCP_README.md](MCP_README.md) for detailed setup instructions.
79
+
80
+ ## Authentication
81
+
82
+ The SDK requires an API key for authentication. You can provide the API key in two ways:
83
+
84
+ 1. **Directly in the client constructor**:
85
+
86
+ ```python
87
+ from smooth import SmoothClient
88
+
89
+ client = SmoothClient(api_key="YOUR_API_KEY")
90
+ ```
91
+
92
+ 2. **As an environment variable**:
93
+
94
+ Set the `CIRCLEMIND_API_KEY` environment variable, and the client will automatically use it.
95
+
96
+ ```bash
97
+ export CIRCLEMIND_API_KEY="YOUR_API_KEY"
98
+ ```
99
+
100
+ ```python
101
+ from smooth import SmoothClient
102
+
103
+ # The client will pick up the API key from the environment variable
104
+ client = SmoothClient()
105
+ ```
106
+
107
+ ## Usage
108
+
109
+ ### Synchronous Client
110
+
111
+ The `SmoothClient` is ideal for scripts and applications that don't require asynchronous operations.
112
+
113
+ #### Running a Task and Waiting for the Result
114
+
115
+ The `run` method returns a `TaskHandle`. You can use the `result()` method on this handle to wait for the task to complete and get its final state.
116
+
117
+ ```python
118
+ from smooth import SmoothClient
119
+ from smooth.models import ApiError, TimeoutError
120
+
121
+ with SmoothClient() as client:
122
+ try:
123
+ # The run method returns a handle to the task immediately
124
+ task_handle = client.run(
125
+ task="Go to https://www.google.com and search for 'Smooth SDK'",
126
+ device="desktop",
127
+ enable_recording=True
128
+ )
129
+ print(f"Task submitted with ID: {task_handle.id}")
130
+ print(f"Live view available at: {task_handle.live_url}")
131
+
132
+ # The result() method waits for the task to complete
133
+ completed_task = task_handle.result()
134
+
135
+ if completed_task.status == "done":
136
+ print("Task Result:", completed_task.output)
137
+ print(f"View recording at: {completed_task.recording_url}")
138
+ else:
139
+ print("Task Failed:", completed_task.output)
140
+
141
+ except TimeoutError:
142
+ print("The task timed out.")
143
+ except ApiError as e:
144
+ print(f"An API error occurred: {e}")
145
+ ```
146
+
147
+ #### Managing Browser Sessions
148
+
149
+ You can create, list, and delete browser sessions to maintain state (like logins) between tasks.
150
+
151
+ ```python
152
+ from smooth import SmoothClient
153
+
154
+ with SmoothClient() as client:
155
+ # Create a new browser session
156
+ browser_session = client.open_session()
157
+ print("Live URL:", browser_session.live_url)
158
+ print("Session ID:", browser_session.session_id)
159
+
160
+ # List all browser sessions
161
+ sessions = client.list_sessions()
162
+ print("All Session IDs:", sessions.session_ids)
163
+
164
+ # Delete the browser session
165
+ client.delete_session(session_id=session_id)
166
+ print(f"Session '{session_id}' deleted.")
167
+ ```
168
+
169
+ ### Asynchronous Client
170
+
171
+ The `SmoothAsyncClient` is designed for use in asynchronous applications, such as those built with `asyncio`, to handle multiple operations concurrently without blocking.
172
+
173
+ #### Running a Task and Waiting for the Result
174
+
175
+ The `run` method returns an `AsyncTaskHandle`. Await the `result()` method on the handle to get the final task status.
176
+
177
+ ```python
178
+ import asyncio
179
+ from smooth import SmoothAsyncClient
180
+ from smooth.models import ApiError, TimeoutError
181
+
182
+ async def main():
183
+ async with SmoothAsyncClient() as client:
184
+ try:
185
+ # The run method returns a handle to the task immediately
186
+ task_handle = await client.run(
187
+ task="Go to Github and search for \"smooth-sdk\""
188
+ )
189
+ print(f"Task submitted with ID: {task_handle.id}")
190
+ print(f"Live view available at: {task_handle.live_url}")
191
+
192
+ # The result() method waits for the task to complete
193
+ completed_task = await task_handle.result()
194
+
195
+ if completed_task.status == "done":
196
+ print("Task Result:", completed_task.output)
197
+ else:
198
+ print("Task Failed:", completed_task.output)
199
+
200
+ except TimeoutError:
201
+ print("The task timed out.")
202
+ except ApiError as e:
203
+ print(f"An API error occurred: {e}")
204
+
205
+ if __name__ == "__main__":
206
+ asyncio.run(main())
207
+ ```
208
+
209
+ ## MCP Server (AI Assistant Integration)
210
+
211
+ The Smooth SDK includes a Model Context Protocol (MCP) server that allows AI assistants like Claude Desktop or Cursor to perform browser automation tasks through natural language commands.
212
+
213
+ ### Installation
214
+
215
+ ```bash
216
+ pip install smooth-py[mcp]
217
+ ```
218
+
219
+ ### Basic Usage
220
+
221
+ ```python
222
+ from smooth.mcp import SmoothMCP
223
+
224
+ # Create and run the MCP server
225
+ mcp = SmoothMCP(api_key="your-api-key")
226
+ mcp.run()
227
+ ```
228
+
229
+ ### Example MCP Usage
230
+
231
+ Once configured, you can ask your MCP client to perform browser automation:
232
+
233
+ - "Please go to news.ycombinator.com and get the top 5 story titles"
234
+ - "Create a browser session, log into Gmail, and check for unread emails"
235
+ - "Go to Amazon and search for wireless headphones under $100"
236
+ - "Fill out the contact form at example.com with test data"
237
+
@@ -0,0 +1,216 @@
1
+ # Smooth Python SDK
2
+
3
+ The Smooth Python SDK provides a convenient way to interact with the Smooth API for programmatic browser automation and task execution.
4
+
5
+ ## Features
6
+
7
+ * **Synchronous and Asynchronous Clients**: Choose between `SmoothClient` for traditional sequential programming and `SmoothAsyncClient` for high-performance asynchronous applications.
8
+ * **Task Management**: Easily run tasks and retrieve results upon completion.
9
+ * **Interactive Browser Sessions**: Get access to, interact with, and delete stateful browser sessions to manage your login credentials.
10
+ * **Advanced Task Configuration**: Customize task execution with options for device type, session recording, stealth mode, and proxy settings.
11
+ * **🆕 MCP Server**: Use the included Model Context Protocol server to integrate browser automation with AI assistants like Claude Desktop.
12
+
13
+ ## Installation
14
+
15
+ You can install the Smooth Python SDK using pip:
16
+
17
+ ```bash
18
+ pip install smooth-py
19
+ ```
20
+
21
+ ## Quick Start Options
22
+
23
+ ### Option 1: Direct SDK Usage
24
+
25
+ Use the SDK directly in your Python applications:
26
+
27
+ ### Option 2: MCP Server (AI Assistant Integration)
28
+
29
+ Use the included MCP server to integrate browser automation with AI assistants:
30
+
31
+ #### Installation
32
+ ```bash
33
+ # Install with MCP support
34
+ pip install smooth-py[mcp]
35
+ ```
36
+
37
+ #### Basic Usage
38
+ ```python
39
+ from smooth.mcp import SmoothMCP
40
+
41
+ # Create and run the MCP server
42
+ mcp = SmoothMCP(api_key="your-api-key")
43
+ mcp.run() # STDIO transport for Claude Desktop
44
+
45
+ # Or with HTTP transport for web deployment
46
+ mcp.run(transport="http", host="0.0.0.0", port=8000)
47
+ ```
48
+
49
+ #### Standalone Script (Backward Compatible)
50
+ ```bash
51
+ # Set your API key
52
+ export CIRCLEMIND_API_KEY="your-api-key-here"
53
+
54
+ # Run the MCP server
55
+ python mcp_server.py
56
+ ```
57
+
58
+ Then configure your AI assistant (like Claude Desktop) to use the MCP server. See [MCP_README.md](MCP_README.md) for detailed setup instructions.
59
+
60
+ ## Authentication
61
+
62
+ The SDK requires an API key for authentication. You can provide the API key in two ways:
63
+
64
+ 1. **Directly in the client constructor**:
65
+
66
+ ```python
67
+ from smooth import SmoothClient
68
+
69
+ client = SmoothClient(api_key="YOUR_API_KEY")
70
+ ```
71
+
72
+ 2. **As an environment variable**:
73
+
74
+ Set the `CIRCLEMIND_API_KEY` environment variable, and the client will automatically use it.
75
+
76
+ ```bash
77
+ export CIRCLEMIND_API_KEY="YOUR_API_KEY"
78
+ ```
79
+
80
+ ```python
81
+ from smooth import SmoothClient
82
+
83
+ # The client will pick up the API key from the environment variable
84
+ client = SmoothClient()
85
+ ```
86
+
87
+ ## Usage
88
+
89
+ ### Synchronous Client
90
+
91
+ The `SmoothClient` is ideal for scripts and applications that don't require asynchronous operations.
92
+
93
+ #### Running a Task and Waiting for the Result
94
+
95
+ The `run` method returns a `TaskHandle`. You can use the `result()` method on this handle to wait for the task to complete and get its final state.
96
+
97
+ ```python
98
+ from smooth import SmoothClient
99
+ from smooth.models import ApiError, TimeoutError
100
+
101
+ with SmoothClient() as client:
102
+ try:
103
+ # The run method returns a handle to the task immediately
104
+ task_handle = client.run(
105
+ task="Go to https://www.google.com and search for 'Smooth SDK'",
106
+ device="desktop",
107
+ enable_recording=True
108
+ )
109
+ print(f"Task submitted with ID: {task_handle.id}")
110
+ print(f"Live view available at: {task_handle.live_url}")
111
+
112
+ # The result() method waits for the task to complete
113
+ completed_task = task_handle.result()
114
+
115
+ if completed_task.status == "done":
116
+ print("Task Result:", completed_task.output)
117
+ print(f"View recording at: {completed_task.recording_url}")
118
+ else:
119
+ print("Task Failed:", completed_task.output)
120
+
121
+ except TimeoutError:
122
+ print("The task timed out.")
123
+ except ApiError as e:
124
+ print(f"An API error occurred: {e}")
125
+ ```
126
+
127
+ #### Managing Browser Sessions
128
+
129
+ You can create, list, and delete browser sessions to maintain state (like logins) between tasks.
130
+
131
+ ```python
132
+ from smooth import SmoothClient
133
+
134
+ with SmoothClient() as client:
135
+ # Create a new browser session
136
+ browser_session = client.open_session()
137
+ print("Live URL:", browser_session.live_url)
138
+ print("Session ID:", browser_session.session_id)
139
+
140
+ # List all browser sessions
141
+ sessions = client.list_sessions()
142
+ print("All Session IDs:", sessions.session_ids)
143
+
144
+ # Delete the browser session
145
+ client.delete_session(session_id=session_id)
146
+ print(f"Session '{session_id}' deleted.")
147
+ ```
148
+
149
+ ### Asynchronous Client
150
+
151
+ The `SmoothAsyncClient` is designed for use in asynchronous applications, such as those built with `asyncio`, to handle multiple operations concurrently without blocking.
152
+
153
+ #### Running a Task and Waiting for the Result
154
+
155
+ The `run` method returns an `AsyncTaskHandle`. Await the `result()` method on the handle to get the final task status.
156
+
157
+ ```python
158
+ import asyncio
159
+ from smooth import SmoothAsyncClient
160
+ from smooth.models import ApiError, TimeoutError
161
+
162
+ async def main():
163
+ async with SmoothAsyncClient() as client:
164
+ try:
165
+ # The run method returns a handle to the task immediately
166
+ task_handle = await client.run(
167
+ task="Go to Github and search for \"smooth-sdk\""
168
+ )
169
+ print(f"Task submitted with ID: {task_handle.id}")
170
+ print(f"Live view available at: {task_handle.live_url}")
171
+
172
+ # The result() method waits for the task to complete
173
+ completed_task = await task_handle.result()
174
+
175
+ if completed_task.status == "done":
176
+ print("Task Result:", completed_task.output)
177
+ else:
178
+ print("Task Failed:", completed_task.output)
179
+
180
+ except TimeoutError:
181
+ print("The task timed out.")
182
+ except ApiError as e:
183
+ print(f"An API error occurred: {e}")
184
+
185
+ if __name__ == "__main__":
186
+ asyncio.run(main())
187
+ ```
188
+
189
+ ## MCP Server (AI Assistant Integration)
190
+
191
+ The Smooth SDK includes a Model Context Protocol (MCP) server that allows AI assistants like Claude Desktop or Cursor to perform browser automation tasks through natural language commands.
192
+
193
+ ### Installation
194
+
195
+ ```bash
196
+ pip install smooth-py[mcp]
197
+ ```
198
+
199
+ ### Basic Usage
200
+
201
+ ```python
202
+ from smooth.mcp import SmoothMCP
203
+
204
+ # Create and run the MCP server
205
+ mcp = SmoothMCP(api_key="your-api-key")
206
+ mcp.run()
207
+ ```
208
+
209
+ ### Example MCP Usage
210
+
211
+ Once configured, you can ask your MCP client to perform browser automation:
212
+
213
+ - "Please go to news.ycombinator.com and get the top 5 story titles"
214
+ - "Create a browser session, log into Gmail, and check for unread emails"
215
+ - "Go to Amazon and search for wireless headphones under $100"
216
+ - "Fill out the contact form at example.com with test data"
@@ -0,0 +1,59 @@
1
+ [project]
2
+ name = "smooth-py"
3
+ version = "0.4.0.post2.dev20260122"
4
+ description = ""
5
+ authors = [
6
+ {name = "Luca Pinchetti",email = "luca@circlemind.co"}
7
+ ]
8
+ readme = "README.md"
9
+ requires-python = ">=3.10,<4.0"
10
+ dependencies = [
11
+ "pydantic (>=2.11.7,<3.0.0)",
12
+ "aiohttp (>=3.9.0,<4.0.0)",
13
+ "deprecated (>=1.2.18,<2.0.0)",
14
+ "nanoid (>=2.0.0,<3.0.0)"
15
+ ]
16
+
17
+ [project.optional-dependencies]
18
+ mcp = [
19
+ "fastmcp (>=2.12.0,<3.0.0)"
20
+ ]
21
+
22
+ [tool.poetry]
23
+ packages = [{include = "smooth", from = "src"}]
24
+
25
+
26
+ [build-system]
27
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
28
+ build-backend = "poetry.core.masonry.api"
29
+
30
+
31
+ [tool.ruff]
32
+ line-length = 128
33
+ indent-width = 2
34
+
35
+ [tool.ruff.lint]
36
+ select = [
37
+ "E", # pycodestyle errors
38
+ "W", # pycodestyle warnings
39
+ "F", # pyflakes
40
+ "I", # isort
41
+ "B", # flake8-bugbear
42
+ "C4", # flake8-comprehensions
43
+ "N", # PEP8 naming convetions
44
+ "D" # pydocstyle
45
+ ]
46
+ ignore = [
47
+ "C901", # too complex
48
+ "W191", # indentation contains tabs
49
+ "D401", # imperative mood
50
+ "B008" # fastapi
51
+ ]
52
+
53
+ [tool.ruff.lint.pydocstyle]
54
+ convention = "google"
55
+
56
+ [tool.pyright]
57
+ typeCheckingMode = "strict"
58
+ reportMissingTypeStubs = false
59
+ reportIncompatibleMethodOverride = false
@@ -0,0 +1,22 @@
1
+ # pyright: reportPrivateUsage=false
2
+ """Smooth python SDK."""
3
+
4
+ from ._client import SmoothAsyncClient, SmoothClient
5
+ from ._exceptions import ApiError, TimeoutError, ToolCallError
6
+ from ._interface import (
7
+ AsyncTaskHandle,
8
+ BrowserSessionHandle,
9
+ TaskHandle,
10
+ )
11
+
12
+ # Export public API
13
+ __all__ = [
14
+ "SmoothClient",
15
+ "SmoothAsyncClient",
16
+ "TaskHandle",
17
+ "AsyncTaskHandle",
18
+ "BrowserSessionHandle",
19
+ "ApiError",
20
+ "TimeoutError",
21
+ "ToolCallError",
22
+ ]