stackshift 1.7.0__tar.gz → 1.8.0__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.
Files changed (78) hide show
  1. {stackshift-1.7.0 → stackshift-1.8.0}/PKG-INFO +208 -1
  2. {stackshift-1.7.0 → stackshift-1.8.0}/README.md +207 -0
  3. {stackshift-1.7.0 → stackshift-1.8.0}/pyproject.toml +1 -1
  4. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/__init__.py +32 -0
  5. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/client.py +5 -0
  6. stackshift-1.8.0/stackshift/computers.py +902 -0
  7. stackshift-1.8.0/stackshift/computers_adapters.py +353 -0
  8. stackshift-1.8.0/stackshift/computers_transfer.py +557 -0
  9. stackshift-1.8.0/stackshift/teams.py +331 -0
  10. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift.egg-info/PKG-INFO +208 -1
  11. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift.egg-info/SOURCES.txt +10 -1
  12. stackshift-1.8.0/tests/test_computers.py +616 -0
  13. stackshift-1.8.0/tests/test_computers_adapters.py +98 -0
  14. stackshift-1.8.0/tests/test_computers_controls.py +202 -0
  15. stackshift-1.8.0/tests/test_computers_routes.py +218 -0
  16. stackshift-1.8.0/tests/test_teams.py +123 -0
  17. {stackshift-1.7.0 → stackshift-1.8.0}/setup.cfg +0 -0
  18. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/agents.py +0 -0
  19. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/ai_credits.py +0 -0
  20. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/assets.py +0 -0
  21. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/assets_dam.py +0 -0
  22. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/assets_media.py +0 -0
  23. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/assets_platform.py +0 -0
  24. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/assets_video.py +0 -0
  25. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/assets_workflows.py +0 -0
  26. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/databases.py +0 -0
  27. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/hosted_agents.py +0 -0
  28. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail.py +0 -0
  29. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_advanced.py +0 -0
  30. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_agent_inboxes.py +0 -0
  31. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_agreements.py +0 -0
  32. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_billing.py +0 -0
  33. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_brands.py +0 -0
  34. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_campaigns.py +0 -0
  35. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_events_webhooks.py +0 -0
  36. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_exports.py +0 -0
  37. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_inbox_webhooks.py +0 -0
  38. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_mailboxes.py +0 -0
  39. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_marketing.py +0 -0
  40. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_migration.py +0 -0
  41. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_reputation.py +0 -0
  42. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_streams.py +0 -0
  43. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_team_inboxes.py +0 -0
  44. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/mail_tracking.py +0 -0
  45. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/partner.py +0 -0
  46. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/projects.py +0 -0
  47. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/support_action_manifest.py +0 -0
  48. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/support_action_receiver.py +0 -0
  49. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/support_action_sqlite.py +0 -0
  50. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/support_action_types.py +0 -0
  51. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/support_actions.py +0 -0
  52. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift/workload_security.py +0 -0
  53. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift.egg-info/dependency_links.txt +0 -0
  54. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift.egg-info/requires.txt +0 -0
  55. {stackshift-1.7.0 → stackshift-1.8.0}/stackshift.egg-info/top_level.txt +0 -0
  56. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_agents.py +0 -0
  57. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_ai_credits.py +0 -0
  58. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_assets_media.py +0 -0
  59. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_assets_platform.py +0 -0
  60. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_assets_workflows.py +0 -0
  61. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_databases.py +0 -0
  62. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_hosted_agents.py +0 -0
  63. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail.py +0 -0
  64. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_advanced.py +0 -0
  65. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_agent_inboxes.py +0 -0
  66. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_agreements.py +0 -0
  67. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_diagnostics.py +0 -0
  68. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_events_webhooks.py +0 -0
  69. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_exports.py +0 -0
  70. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_inbox_webhooks.py +0 -0
  71. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_mailboxes.py +0 -0
  72. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_platform.py +0 -0
  73. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_simulation.py +0 -0
  74. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_subscribers.py +0 -0
  75. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_team_inboxes.py +0 -0
  76. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_mail_tracking.py +0 -0
  77. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_partner.py +0 -0
  78. {stackshift-1.7.0 → stackshift-1.8.0}/tests/test_support_actions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackshift
3
- Version: 1.7.0
3
+ Version: 1.8.0
4
4
  Summary: Official Python SDK for StackShift.
5
5
  Author-email: StackShift <support@stackshift.cloud>
6
6
  Project-URL: Homepage, https://stackshift.cloud
@@ -20,6 +20,185 @@ Official Python SDK for StackShift.
20
20
  pip install stackshift
21
21
  ```
22
22
 
23
+ ## Computers
24
+
25
+ Cloud computers any agent can drive. Use a computers key as `api_key`.
26
+
27
+ ```python
28
+ computer = stackshift.computers.create(project_id, "agent-desktop", vcpus=4, memory_gb=8)
29
+ computer.exec("npm install && npm test", cwd="/workspace/app")
30
+ computer.files.write("notes.txt", "hello")
31
+ port = computer.ports.publish(3000, "public")
32
+ computer.click(640, 360, screenshot=True)
33
+ computer.type("hello")
34
+ copies = computer.fork(count=3)
35
+ answer = computer.ask_owner("Send the invoice?")
36
+ computer.pause("memory")
37
+ ```
38
+
39
+ `computer.cdp_url()` returns a WebSocket URL for `playwright.chromium.connect_over_cdp(url)`. `live_url()`, `view_link()` and `terminal_url()` return the other session URLs, and `events()` streams state changes and steps.
40
+
41
+ Move files and folders with `computer.files`. Files under 8 MiB go in one request; larger files move in parallel 64 MiB signed parts with checksums, retries and a final sha256 check.
42
+
43
+ ```python
44
+ computer.files.upload("./model.bin", "models/model.bin", concurrency=4)
45
+ computer.files.download("results/out.csv", "./out.csv")
46
+ computer.files.upload_dir("./app", "app", exclude=["node_modules", "*.log"])
47
+ computer.files.download_dir("app/dist", "./dist")
48
+ computer.files.mkdir("app/tmp", parents=True)
49
+ computer.files.remove("app/tmp", recursive=True)
50
+ ```
51
+
52
+ `upload_dir` skips `.gitignore`d files in a git folder unless you pass `include_ignored=True`, and keeps modes, symlinks and modification times.
53
+
54
+ Pick `vcpus` and `memory_gb` from the template's sizes (`templates()` lists them), for example 2 vCPU / 8 GB or 4 vCPU / 16 GB. `region` picks where it starts; `computers.regions(project_id)` lists the regions open now.
55
+
56
+ Tell people what an agent is doing. The dashboard shows the task and next step beside the screen, and `ask_owner` carries the next step on its card.
57
+
58
+ ```python
59
+ computer.set_task(task="Book the flight", next_step="Open the airline site")
60
+ computer.click(640, 360, task="Book the flight", next_step="Pick a seat")
61
+ computer.ask_owner("Pay $240?", next_step="Send the receipt")
62
+ computer.clear_task()
63
+ info = computer.refresh()
64
+ print(info.get("region_name"), info.get("task"), info.get("next_step"), info.get("fork_duration_ms"))
65
+ ```
66
+
67
+ Read the machine without waking it or adding a step:
68
+
69
+ ```python
70
+ system = computer.system()
71
+ print(system["os_name"], system["kernel"], system["services"], system["listening"], system.get("pauses_at"))
72
+ windows = computer.list_windows()["windows"]
73
+ ```
74
+
75
+ `internet={"mode": "none"}` blocks all outbound access (`open` and `allowlist` are the others). Approvals carry `next_step`, `notified_at` and `notified_channels`.
76
+
77
+ The paying account's spending limit, defaults for new computers and notification choices:
78
+
79
+ ```python
80
+ settings = stackshift.computers.settings(project_id)
81
+ stackshift.computers.save_settings(
82
+ project_id,
83
+ spend_cap={"amount_minor": 500_000, "currency": "NGN"},
84
+ default_approvals=True,
85
+ notifications={"email": True, "push": True},
86
+ )
87
+ stackshift.computers.save_settings(project_id, spend_cap=None)
88
+ ```
89
+
90
+ Import a Docker image as a snapshot and follow it:
91
+
92
+ ```python
93
+ result = stackshift.computers.import_image(
94
+ project_id, "node:22", "node-22",
95
+ internet={"mode": "allowlist", "allowed_domains": ["registry.npmjs.org"]},
96
+ idle_policy={"pause_after_seconds": 600, "mode": "disk"}, access={"keys": True}, logins=["github"], delete_after_seconds=604800,
97
+ )
98
+ progress = stackshift.computers.setup(result["computer"]["id"])
99
+ ```
100
+
101
+ Run a setup on a computer, or ask for one when you create it. Send exactly one of a script, a `devcontainer.json` already on the computer, or a repository to clone:
102
+
103
+ ```python
104
+ computer.start_setup({"script": {"content": "npm ci", "cwd": "/workspace/app"}})
105
+ computer.start_setup({"devcontainer": {"workspace_folder": "/workspace/app"}})
106
+ computer.start_setup({"source": {"repository": "acme/app", "directory": "/workspace/app", "token": github_token}})
107
+ progress = computer.setup()
108
+
109
+ stackshift.computers.create(
110
+ project_id, "coding", source={"repository": "acme/app", "token": github_token},
111
+ setup={"devcontainer": {"workspace_folder": "/workspace/app"}},
112
+ max_run_seconds=3600, archive_after_seconds=7200, delete_after_seconds=86400,
113
+ )
114
+ ```
115
+
116
+ Run GitHub Actions jobs on computers with `computers.ci`:
117
+
118
+ ```python
119
+ labels = stackshift.computers.ci.labels(project_id)
120
+ overview = stackshift.computers.ci.overview(project_id)
121
+ jobs = stackshift.computers.ci.jobs(project_id, limit=20)
122
+ link = stackshift.computers.ci.connect(project_id, installation_id)
123
+ stackshift.computers.ci.disconnect(link["id"])
124
+ circle = stackshift.computers.ci.connect_circleci(project_id, "acme/stackshift", "small", api_token)
125
+ stackshift.computers.ci.disconnect_circleci(circle["id"])
126
+ ```
127
+
128
+ Runner labels include `stackshift-small`, `stackshift-small-mem` (2 vCPU / 8 GB), `stackshift-medium`, `stackshift-medium-mem` (4 vCPU / 16 GB), `stackshift-large` and `stackshift-xlarge`.
129
+
130
+ Deleting a computer or a snapshot sends `X-StackShift-Confirm-Delete` with its id; the server answers 428 `confirmation_required` without it. Pass `confirm="name"` to send the name instead.
131
+
132
+ Run commands with live output and input:
133
+
134
+ ```python
135
+ for event in computer.exec_stream("npm test", cwd="/workspace/app"):
136
+ print(event["event"], event["data"])
137
+ result = computer.exec("cat", stdin="hello", stdin_open=False)
138
+ computer.send_stdin(command_id, "yes\n", close=True)
139
+ ```
140
+
141
+ `exec_stream` yields `start`, `stdout`, `stderr`, `exit` and `error` events as `{"event", "data"}`. Background jobs and past commands:
142
+
143
+ ```python
144
+ computer.history(limit=20)
145
+ computer.command()
146
+ computer.jobs()
147
+ computer.job_logs(job_id, offset=0)
148
+ for chunk in computer.follow_job_logs(job_id):
149
+ print(chunk["event"], chunk["data"])
150
+ computer.wait_job(job_id, timeout_seconds=30)
151
+ computer.kill_job(job_id, "KILL")
152
+ ```
153
+
154
+ Keep a computer awake while work runs, and read its limits and metrics:
155
+
156
+ ```python
157
+ computer.put_activity_lease("lint", 120)
158
+ computer.activity_leases()
159
+ computer.release_activity_lease("lint")
160
+ computer.limits()
161
+ computer.metrics(since="2026-11-10T00:00:00Z")
162
+ ```
163
+
164
+ SSH access without a long-lived key:
165
+
166
+ ```python
167
+ computer.create_ssh_token(ttl_seconds=3600)
168
+ computer.revoke_ssh_tokens()
169
+ stackshift.computers.ssh_certificate(computer.id, public_key)
170
+ ```
171
+
172
+ Drive the coding agent that runs on the computer:
173
+
174
+ ```python
175
+ conversation = computer.prompt_agent("fix the failing tests", provider="claude")
176
+ for event in computer.follow_agent_events(conversation["id"]):
177
+ print(event["kind"], event.get("text"))
178
+ computer.steer_agent(conversation["id"], "run the linter too")
179
+ computer.interrupt_agent(conversation["id"])
180
+ computer.agent_conversations()
181
+ computer.agent_events(conversation["id"], after_seq=10, limit=50)
182
+ ```
183
+
184
+ `computers.keys.create(project_id, name, scopes=["computers:read"])` limits a key to `computers:read`, `computers:write`, `computers:use` or `computers:delete`. A stuck large upload resumes with `computers.resume_upload(computer_id, transfer_id, upload_id, part_md5)`.
185
+
186
+ An agent can get its own key without any existing key. The functions below send no `Authorization` header:
187
+
188
+ ```python
189
+ registration = register_computer_agent("agent@host", ["computers:use"])
190
+ print(registration["verification_uri_complete"], registration["user_code"])
191
+ issued = wait_for_computer_agent_key(registration)
192
+ ```
193
+
194
+ `wait_for_computer_agent_key` polls at the registration's `interval`, adds 5 seconds on `slow_down`, keeps going on `authorization_pending`, raises `StackShiftAPIError` on any other code and `ComputerWaitError` when `expires_in` passes. `exchange_computer_agent_claim(claim_token)` makes one attempt. The owner reviews the request with `computers.agent_claim(code)` and answers with `computers.decide_agent_claim(code, True, scopes=[...], project_id=project_id)`.
195
+
196
+ Prices include data out per GB (`egress_gb`, and `data_out` lines in `usage`). `computers.public_pricing()` returns the naira and dollar rates, the free plan's allowance and each plan's running limit without needing a computer or project. `computer_public_pricing()` does the same with no client and no key, for example on a pricing page: `computer_public_pricing(base_url=None, session=None)` sends no `Authorization` header.
197
+
198
+ Errors are `StackShiftAPIError` with a `code`: `COMPUTER_LIMIT_EXCEEDED` (`limit_exceeded`, 429) over your limits or free hours, `COMPUTER_CAPACITY_BUSY` (`capacity_busy`, 429) the free share is busy so retry later, and `COMPUTER_SPEND_CAP_REACHED` (`spend_cap_reached`, 402) the account's spending limit is reached.
199
+
200
+ `AnthropicComputerAdapter`, `OpenAIComputerAdapter`, `GeminiComputerAdapter` and `FunctionComputerAdapter` turn each provider's computer-use actions into computer actions and return the screenshot in the provider's reply shape, for example `AnthropicComputerAdapter(computer, max_width=1280).tool_result(tool_use_id, tool_input)`.
201
+
23
202
  ## Partner platforms
24
203
 
25
204
  Staff-enabled partner accounts buy domains for merchants from their StackShift wallet. Use an API token with the `partner:manage` scope (and `mail:manage` to run campaigns) on your server:
@@ -507,3 +686,31 @@ PYTHONPATH=. python examples/support_action_receiver.py /absolute/path/claims.sq
507
686
  Send the returned `body` unchanged with `headers`. Execution retries retain exact original bytes and request ID with fresh delivery IDs. A handler error is stored as unknown; running/unknown work is never dispatched again. Reconciliation is a separate handler with empty arguments and the original target request ID, and must query actual downstream state. Accepted results remain replayable; there is no asynchronous callback endpoint yet. Disk claims do not make remote side effects atomic: use downstream idempotency or one transactional business/receipt store, and preserve uncertain claims for reconciliation/human review. This is a single-host SQLite example; distributed receivers need a shared durable store.
508
687
 
509
688
  See `../support-actions-conformance/README.md` for exact signatures and adapter requirements. Seven action tests pass, including shared vectors, two-connection concurrency, restart and fenced completion. The existing virtualenv is required here because system Python lacks the SDK's declared `requests` dependency. No live installation/provider qualification was performed; unreleased.
689
+
690
+ ## Computer teams
691
+
692
+ A team is several computers working one job together, each running an agent (`claude-code`, `codex`, `gemini`, `opencode` or `custom`), with a shared folder, a private network and a message board. Use a computers key, a personal API token or a dashboard session as `api_key`.
693
+
694
+ ```python
695
+ team = stackshift.computers.teams.create(
696
+ project_id,
697
+ "checkout-fix",
698
+ "Refunds fail on partial orders. Claude fixes, Codex reviews, Gemini proves it with tests.",
699
+ [
700
+ {"name": "claude-fixer", "agent": "claude-code", "role": "Writes the fix"},
701
+ {"name": "codex-reviewer", "agent": "codex"},
702
+ {"name": "gemini-tests", "agent": "gemini"},
703
+ ],
704
+ repository={"repository": "github.com/northwind/api", "revision": "main"},
705
+ stop_rule="done",
706
+ spend_limit={"amount_minor": 2000000, "currency": "NGN"},
707
+ )
708
+ stackshift.teams.send(team["id"], "Start with the partial refund path.", to="claude-fixer")
709
+ page = stackshift.teams.wait_for_messages(team["id"], after_seq=0, timeout=60)
710
+ for message in stackshift.teams.stream_messages(team["id"], after_seq=page["next_seq"]):
711
+ print(message["from"]["name"], message["text"])
712
+ ```
713
+
714
+ `create` and `add_member` send an `Idempotency-Key` (pass `idempotency_key=` to reuse one). `update` takes `job`, `stop_rule`, `spend_limit` (`None` clears it) and `ask_before_acting`. `pause` and `resume` act on every member. `delete` sends the `X-StackShift-Confirm-Delete` header with the team id (pass `confirm=` to send the name) and deletes every member computer and the shared folder. `remove_member(team_id, member_id, keep_computer=True)` keeps the member's computer.
715
+
716
+ `list_messages(team_id, after_seq=, limit=, wait=)` long-polls for up to 25 seconds with `wait`. `wait_for_messages` keeps polling until a message arrives or `timeout` passes and returns the page, with empty `items` on timeout. `stream_messages` yields each message from the server-sent event stream, skips pings and reconnects from the last `seq`. `files(team_id, "/shared")`, `network(team_id)` and `activity(team_id)` read the shared folder, the member addresses and what each member is doing. The response shapes are `TypedDict`s in `stackshift.teams`.
@@ -8,6 +8,185 @@ Official Python SDK for StackShift.
8
8
  pip install stackshift
9
9
  ```
10
10
 
11
+ ## Computers
12
+
13
+ Cloud computers any agent can drive. Use a computers key as `api_key`.
14
+
15
+ ```python
16
+ computer = stackshift.computers.create(project_id, "agent-desktop", vcpus=4, memory_gb=8)
17
+ computer.exec("npm install && npm test", cwd="/workspace/app")
18
+ computer.files.write("notes.txt", "hello")
19
+ port = computer.ports.publish(3000, "public")
20
+ computer.click(640, 360, screenshot=True)
21
+ computer.type("hello")
22
+ copies = computer.fork(count=3)
23
+ answer = computer.ask_owner("Send the invoice?")
24
+ computer.pause("memory")
25
+ ```
26
+
27
+ `computer.cdp_url()` returns a WebSocket URL for `playwright.chromium.connect_over_cdp(url)`. `live_url()`, `view_link()` and `terminal_url()` return the other session URLs, and `events()` streams state changes and steps.
28
+
29
+ Move files and folders with `computer.files`. Files under 8 MiB go in one request; larger files move in parallel 64 MiB signed parts with checksums, retries and a final sha256 check.
30
+
31
+ ```python
32
+ computer.files.upload("./model.bin", "models/model.bin", concurrency=4)
33
+ computer.files.download("results/out.csv", "./out.csv")
34
+ computer.files.upload_dir("./app", "app", exclude=["node_modules", "*.log"])
35
+ computer.files.download_dir("app/dist", "./dist")
36
+ computer.files.mkdir("app/tmp", parents=True)
37
+ computer.files.remove("app/tmp", recursive=True)
38
+ ```
39
+
40
+ `upload_dir` skips `.gitignore`d files in a git folder unless you pass `include_ignored=True`, and keeps modes, symlinks and modification times.
41
+
42
+ Pick `vcpus` and `memory_gb` from the template's sizes (`templates()` lists them), for example 2 vCPU / 8 GB or 4 vCPU / 16 GB. `region` picks where it starts; `computers.regions(project_id)` lists the regions open now.
43
+
44
+ Tell people what an agent is doing. The dashboard shows the task and next step beside the screen, and `ask_owner` carries the next step on its card.
45
+
46
+ ```python
47
+ computer.set_task(task="Book the flight", next_step="Open the airline site")
48
+ computer.click(640, 360, task="Book the flight", next_step="Pick a seat")
49
+ computer.ask_owner("Pay $240?", next_step="Send the receipt")
50
+ computer.clear_task()
51
+ info = computer.refresh()
52
+ print(info.get("region_name"), info.get("task"), info.get("next_step"), info.get("fork_duration_ms"))
53
+ ```
54
+
55
+ Read the machine without waking it or adding a step:
56
+
57
+ ```python
58
+ system = computer.system()
59
+ print(system["os_name"], system["kernel"], system["services"], system["listening"], system.get("pauses_at"))
60
+ windows = computer.list_windows()["windows"]
61
+ ```
62
+
63
+ `internet={"mode": "none"}` blocks all outbound access (`open` and `allowlist` are the others). Approvals carry `next_step`, `notified_at` and `notified_channels`.
64
+
65
+ The paying account's spending limit, defaults for new computers and notification choices:
66
+
67
+ ```python
68
+ settings = stackshift.computers.settings(project_id)
69
+ stackshift.computers.save_settings(
70
+ project_id,
71
+ spend_cap={"amount_minor": 500_000, "currency": "NGN"},
72
+ default_approvals=True,
73
+ notifications={"email": True, "push": True},
74
+ )
75
+ stackshift.computers.save_settings(project_id, spend_cap=None)
76
+ ```
77
+
78
+ Import a Docker image as a snapshot and follow it:
79
+
80
+ ```python
81
+ result = stackshift.computers.import_image(
82
+ project_id, "node:22", "node-22",
83
+ internet={"mode": "allowlist", "allowed_domains": ["registry.npmjs.org"]},
84
+ idle_policy={"pause_after_seconds": 600, "mode": "disk"}, access={"keys": True}, logins=["github"], delete_after_seconds=604800,
85
+ )
86
+ progress = stackshift.computers.setup(result["computer"]["id"])
87
+ ```
88
+
89
+ Run a setup on a computer, or ask for one when you create it. Send exactly one of a script, a `devcontainer.json` already on the computer, or a repository to clone:
90
+
91
+ ```python
92
+ computer.start_setup({"script": {"content": "npm ci", "cwd": "/workspace/app"}})
93
+ computer.start_setup({"devcontainer": {"workspace_folder": "/workspace/app"}})
94
+ computer.start_setup({"source": {"repository": "acme/app", "directory": "/workspace/app", "token": github_token}})
95
+ progress = computer.setup()
96
+
97
+ stackshift.computers.create(
98
+ project_id, "coding", source={"repository": "acme/app", "token": github_token},
99
+ setup={"devcontainer": {"workspace_folder": "/workspace/app"}},
100
+ max_run_seconds=3600, archive_after_seconds=7200, delete_after_seconds=86400,
101
+ )
102
+ ```
103
+
104
+ Run GitHub Actions jobs on computers with `computers.ci`:
105
+
106
+ ```python
107
+ labels = stackshift.computers.ci.labels(project_id)
108
+ overview = stackshift.computers.ci.overview(project_id)
109
+ jobs = stackshift.computers.ci.jobs(project_id, limit=20)
110
+ link = stackshift.computers.ci.connect(project_id, installation_id)
111
+ stackshift.computers.ci.disconnect(link["id"])
112
+ circle = stackshift.computers.ci.connect_circleci(project_id, "acme/stackshift", "small", api_token)
113
+ stackshift.computers.ci.disconnect_circleci(circle["id"])
114
+ ```
115
+
116
+ Runner labels include `stackshift-small`, `stackshift-small-mem` (2 vCPU / 8 GB), `stackshift-medium`, `stackshift-medium-mem` (4 vCPU / 16 GB), `stackshift-large` and `stackshift-xlarge`.
117
+
118
+ Deleting a computer or a snapshot sends `X-StackShift-Confirm-Delete` with its id; the server answers 428 `confirmation_required` without it. Pass `confirm="name"` to send the name instead.
119
+
120
+ Run commands with live output and input:
121
+
122
+ ```python
123
+ for event in computer.exec_stream("npm test", cwd="/workspace/app"):
124
+ print(event["event"], event["data"])
125
+ result = computer.exec("cat", stdin="hello", stdin_open=False)
126
+ computer.send_stdin(command_id, "yes\n", close=True)
127
+ ```
128
+
129
+ `exec_stream` yields `start`, `stdout`, `stderr`, `exit` and `error` events as `{"event", "data"}`. Background jobs and past commands:
130
+
131
+ ```python
132
+ computer.history(limit=20)
133
+ computer.command()
134
+ computer.jobs()
135
+ computer.job_logs(job_id, offset=0)
136
+ for chunk in computer.follow_job_logs(job_id):
137
+ print(chunk["event"], chunk["data"])
138
+ computer.wait_job(job_id, timeout_seconds=30)
139
+ computer.kill_job(job_id, "KILL")
140
+ ```
141
+
142
+ Keep a computer awake while work runs, and read its limits and metrics:
143
+
144
+ ```python
145
+ computer.put_activity_lease("lint", 120)
146
+ computer.activity_leases()
147
+ computer.release_activity_lease("lint")
148
+ computer.limits()
149
+ computer.metrics(since="2026-11-10T00:00:00Z")
150
+ ```
151
+
152
+ SSH access without a long-lived key:
153
+
154
+ ```python
155
+ computer.create_ssh_token(ttl_seconds=3600)
156
+ computer.revoke_ssh_tokens()
157
+ stackshift.computers.ssh_certificate(computer.id, public_key)
158
+ ```
159
+
160
+ Drive the coding agent that runs on the computer:
161
+
162
+ ```python
163
+ conversation = computer.prompt_agent("fix the failing tests", provider="claude")
164
+ for event in computer.follow_agent_events(conversation["id"]):
165
+ print(event["kind"], event.get("text"))
166
+ computer.steer_agent(conversation["id"], "run the linter too")
167
+ computer.interrupt_agent(conversation["id"])
168
+ computer.agent_conversations()
169
+ computer.agent_events(conversation["id"], after_seq=10, limit=50)
170
+ ```
171
+
172
+ `computers.keys.create(project_id, name, scopes=["computers:read"])` limits a key to `computers:read`, `computers:write`, `computers:use` or `computers:delete`. A stuck large upload resumes with `computers.resume_upload(computer_id, transfer_id, upload_id, part_md5)`.
173
+
174
+ An agent can get its own key without any existing key. The functions below send no `Authorization` header:
175
+
176
+ ```python
177
+ registration = register_computer_agent("agent@host", ["computers:use"])
178
+ print(registration["verification_uri_complete"], registration["user_code"])
179
+ issued = wait_for_computer_agent_key(registration)
180
+ ```
181
+
182
+ `wait_for_computer_agent_key` polls at the registration's `interval`, adds 5 seconds on `slow_down`, keeps going on `authorization_pending`, raises `StackShiftAPIError` on any other code and `ComputerWaitError` when `expires_in` passes. `exchange_computer_agent_claim(claim_token)` makes one attempt. The owner reviews the request with `computers.agent_claim(code)` and answers with `computers.decide_agent_claim(code, True, scopes=[...], project_id=project_id)`.
183
+
184
+ Prices include data out per GB (`egress_gb`, and `data_out` lines in `usage`). `computers.public_pricing()` returns the naira and dollar rates, the free plan's allowance and each plan's running limit without needing a computer or project. `computer_public_pricing()` does the same with no client and no key, for example on a pricing page: `computer_public_pricing(base_url=None, session=None)` sends no `Authorization` header.
185
+
186
+ Errors are `StackShiftAPIError` with a `code`: `COMPUTER_LIMIT_EXCEEDED` (`limit_exceeded`, 429) over your limits or free hours, `COMPUTER_CAPACITY_BUSY` (`capacity_busy`, 429) the free share is busy so retry later, and `COMPUTER_SPEND_CAP_REACHED` (`spend_cap_reached`, 402) the account's spending limit is reached.
187
+
188
+ `AnthropicComputerAdapter`, `OpenAIComputerAdapter`, `GeminiComputerAdapter` and `FunctionComputerAdapter` turn each provider's computer-use actions into computer actions and return the screenshot in the provider's reply shape, for example `AnthropicComputerAdapter(computer, max_width=1280).tool_result(tool_use_id, tool_input)`.
189
+
11
190
  ## Partner platforms
12
191
 
13
192
  Staff-enabled partner accounts buy domains for merchants from their StackShift wallet. Use an API token with the `partner:manage` scope (and `mail:manage` to run campaigns) on your server:
@@ -495,3 +674,31 @@ PYTHONPATH=. python examples/support_action_receiver.py /absolute/path/claims.sq
495
674
  Send the returned `body` unchanged with `headers`. Execution retries retain exact original bytes and request ID with fresh delivery IDs. A handler error is stored as unknown; running/unknown work is never dispatched again. Reconciliation is a separate handler with empty arguments and the original target request ID, and must query actual downstream state. Accepted results remain replayable; there is no asynchronous callback endpoint yet. Disk claims do not make remote side effects atomic: use downstream idempotency or one transactional business/receipt store, and preserve uncertain claims for reconciliation/human review. This is a single-host SQLite example; distributed receivers need a shared durable store.
496
675
 
497
676
  See `../support-actions-conformance/README.md` for exact signatures and adapter requirements. Seven action tests pass, including shared vectors, two-connection concurrency, restart and fenced completion. The existing virtualenv is required here because system Python lacks the SDK's declared `requests` dependency. No live installation/provider qualification was performed; unreleased.
677
+
678
+ ## Computer teams
679
+
680
+ A team is several computers working one job together, each running an agent (`claude-code`, `codex`, `gemini`, `opencode` or `custom`), with a shared folder, a private network and a message board. Use a computers key, a personal API token or a dashboard session as `api_key`.
681
+
682
+ ```python
683
+ team = stackshift.computers.teams.create(
684
+ project_id,
685
+ "checkout-fix",
686
+ "Refunds fail on partial orders. Claude fixes, Codex reviews, Gemini proves it with tests.",
687
+ [
688
+ {"name": "claude-fixer", "agent": "claude-code", "role": "Writes the fix"},
689
+ {"name": "codex-reviewer", "agent": "codex"},
690
+ {"name": "gemini-tests", "agent": "gemini"},
691
+ ],
692
+ repository={"repository": "github.com/northwind/api", "revision": "main"},
693
+ stop_rule="done",
694
+ spend_limit={"amount_minor": 2000000, "currency": "NGN"},
695
+ )
696
+ stackshift.teams.send(team["id"], "Start with the partial refund path.", to="claude-fixer")
697
+ page = stackshift.teams.wait_for_messages(team["id"], after_seq=0, timeout=60)
698
+ for message in stackshift.teams.stream_messages(team["id"], after_seq=page["next_seq"]):
699
+ print(message["from"]["name"], message["text"])
700
+ ```
701
+
702
+ `create` and `add_member` send an `Idempotency-Key` (pass `idempotency_key=` to reuse one). `update` takes `job`, `stop_rule`, `spend_limit` (`None` clears it) and `ask_before_acting`. `pause` and `resume` act on every member. `delete` sends the `X-StackShift-Confirm-Delete` header with the team id (pass `confirm=` to send the name) and deletes every member computer and the shared folder. `remove_member(team_id, member_id, keep_computer=True)` keeps the member's computer.
703
+
704
+ `list_messages(team_id, after_seq=, limit=, wait=)` long-polls for up to 25 seconds with `wait`. `wait_for_messages` keeps polling until a message arrives or `timeout` passes and returns the page, with empty `items` on timeout. `stream_messages` yields each message from the server-sent event stream, skips pings and reconnects from the last `seq`. `files(team_id, "/shared")`, `network(team_id)` and `activity(team_id)` read the shared folder, the member addresses and what each member is doing. The response shapes are `TypedDict`s in `stackshift.teams`.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "stackshift"
7
- version = "1.7.0"
7
+ version = "1.8.0"
8
8
  description = "Official Python SDK for StackShift."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -2,6 +2,15 @@ from .client import StackShift
2
2
  from .agents import AgentConnectionOperationsClient, AgentConnectionsClient, AgentsClient
3
3
  from .ai_credits import AICreditsClient
4
4
  from .assets import ASSET_TRANSFORM_PRESETS, AssetsClient, asset_transform_options, asset_transform_spec, get_asset_transform_preset
5
+ from .computers import COMPUTER_CAPACITY_BUSY, COMPUTER_LIMIT_EXCEEDED, COMPUTER_SPEND_CAP_REACHED, Computer, ComputerActionError, ComputerCIClient, ComputerKeysClient, ComputersClient, ComputerSnapshotsClient, ComputerTransferError, ComputerWaitError, computer_public_pricing, exchange_computer_agent_claim, register_computer_agent, wait_for_computer_agent_key
6
+ from .computers_adapters import (
7
+ AnthropicComputerAdapter,
8
+ FunctionComputerAdapter,
9
+ GeminiComputerAdapter,
10
+ OpenAIComputerAdapter,
11
+ UnsupportedComputerAction,
12
+ COMPUTER_FUNCTION_TOOLS,
13
+ )
5
14
  from .databases import DatabaseBranchesClient, DatabaseOperationFailed, DatabasesClient
6
15
  from .hosted_agents import HostedAgentBudgetClient, HostedAgentSecretsClient, HostedAgentsClient
7
16
  from .mail import (
@@ -45,10 +54,33 @@ from .mail_inbox_webhooks import (
45
54
  )
46
55
  from .partner import PartnerClient
47
56
  from .projects import ProjectsClient
57
+ from .teams import ComputerTeamsClient
48
58
  from .workload_security import WorkloadSecurityClient
49
59
 
50
60
  __all__ = [
51
61
  "StackShift",
62
+ "COMPUTER_CAPACITY_BUSY",
63
+ "COMPUTER_LIMIT_EXCEEDED",
64
+ "COMPUTER_SPEND_CAP_REACHED",
65
+ "Computer",
66
+ "ComputerActionError",
67
+ "ComputerCIClient",
68
+ "computer_public_pricing",
69
+ "exchange_computer_agent_claim",
70
+ "register_computer_agent",
71
+ "wait_for_computer_agent_key",
72
+ "ComputerKeysClient",
73
+ "ComputersClient",
74
+ "ComputerSnapshotsClient",
75
+ "ComputerTeamsClient",
76
+ "ComputerTransferError",
77
+ "ComputerWaitError",
78
+ "AnthropicComputerAdapter",
79
+ "FunctionComputerAdapter",
80
+ "GeminiComputerAdapter",
81
+ "OpenAIComputerAdapter",
82
+ "UnsupportedComputerAction",
83
+ "COMPUTER_FUNCTION_TOOLS",
52
84
  "AICreditsClient",
53
85
  "AgentConnectionOperationsClient",
54
86
  "AgentConnectionsClient",
@@ -30,17 +30,22 @@ class StackShift:
30
30
  from .agents import AgentsClient
31
31
  from .ai_credits import AICreditsClient
32
32
  from .assets import AssetsClient
33
+ from .computers import ComputersClient
33
34
  from .databases import DatabasesClient
34
35
  from .hosted_agents import HostedAgentsClient
35
36
  from .mail import MailClient
36
37
  from .partner import PartnerClient
37
38
  from .projects import ProjectsClient
39
+ from .teams import ComputerTeamsClient
38
40
  from .workload_security import WorkloadSecurityClient
39
41
 
40
42
  self.agents = AgentsClient(self)
41
43
  self.ai_credits = AICreditsClient(self)
42
44
  self.projects = ProjectsClient(self)
43
45
  self.assets = AssetsClient(self)
46
+ self.computers = ComputersClient(self)
47
+ self.computers.teams = ComputerTeamsClient(self)
48
+ self.teams = self.computers.teams
44
49
  self.databases = DatabasesClient(self)
45
50
  self.hosted_agents = HostedAgentsClient(self)
46
51
  self.mail = MailClient(self)