labelbox-recursion-sdk 0.1.0__tar.gz → 0.1.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.
Files changed (20) hide show
  1. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/PKG-INFO +79 -11
  2. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/README.md +78 -10
  3. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/pyproject.toml +1 -1
  4. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/pyproject.toml.orig +1 -1
  5. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/src/recursion_sdk/_generated/client.py +6343 -1814
  6. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/src/recursion_sdk/_generated/models.py +13191 -4125
  7. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/src/recursion_sdk/_generated/openapi.json +65317 -21231
  8. labelbox_recursion_sdk-0.1.1/tests/test_client.py +1023 -0
  9. labelbox_recursion_sdk-0.1.1/tests/test_generation.py +331 -0
  10. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/tools/generate.py +283 -11
  11. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/tools/verify_distribution.py +27 -6
  12. labelbox_recursion_sdk-0.1.0/tests/test_client.py +0 -549
  13. labelbox_recursion_sdk-0.1.0/tests/test_generation.py +0 -189
  14. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/src/recursion_sdk/__init__.py +0 -0
  15. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/src/recursion_sdk/_generated/__init__.py +0 -0
  16. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/src/recursion_sdk/_transport.py +0 -0
  17. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/src/recursion_sdk/_types.py +0 -0
  18. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/src/recursion_sdk/py.typed +0 -0
  19. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/tools/check.py +0 -0
  20. {labelbox_recursion_sdk-0.1.0 → labelbox_recursion_sdk-0.1.1}/tools/uv +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: labelbox-recursion-sdk
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Typed Python SDK for the Recursion API
5
5
  Requires-Dist: httpx>=0.28.1,<0.29
6
6
  Requires-Dist: pydantic>=2.12,<3
@@ -14,7 +14,7 @@ Description-Content-Type: text/markdown
14
14
 
15
15
  Typed, synchronous and asynchronous request/response access to the Recursion
16
16
  API. The client and Pydantic models are generated from Recursion's committed
17
- public OpenAPI contract snapshots. Session-event streaming is excluded.
17
+ public OpenAPI contract snapshots. Session-event and gestalt streaming are excluded.
18
18
 
19
19
  The distribution is
20
20
  [`labelbox-recursion-sdk`](https://pypi.org/project/labelbox-recursion-sdk/),
@@ -39,6 +39,22 @@ Set `organization_id` or `tenant_id` on the constructor when the API key
39
39
  requires those selectors. Operation-level selectors may repeat those values;
40
40
  they cannot change the constructor's scope.
41
41
 
42
+ The agent, agent-version, vault, credential, memory-list, agent-template,
43
+ environment, setup-run, environment-template, sandbox-provider, and session
44
+ discovery/overview read methods use
45
+ `/managed-agents/v2` by default. For example,
46
+ `managed_agents.list_agents(limit=50, cursor=...)` returns the v2 page with
47
+ `items`, `nextCursor`, and `total`; `managed_agents.list_environments(limit=50,
48
+ cursor=...)` returns `items` and `nextCursor`; and
49
+ `managed_agents.list_sessions(limit=50, cursor=...)` returns `items`,
50
+ `nextCursor`, and a nullable `total`. The explicit `*_v2` names remain
51
+ available; use `*_v1` to call the deprecated legacy endpoints and receive their
52
+ legacy shapes. Those calls emit `DeprecationWarning` and their docstrings point
53
+ to the v2 replacement. Skill and skill-group methods also use v2 by default,
54
+ including the camelCase request and response models; their explicit `*_v1`
55
+ methods retain the deprecated legacy contracts. Other Managed Agents methods
56
+ use the version declared by the public contract.
57
+
42
58
  Methods return `ApiResponse` with typed `data` and the original HTTPX
43
59
  `response`, including status and headers. A declared bodyless 304 has
44
60
  `data=None`. Declared API errors raise `RecursionAPIError`; malformed or
@@ -54,13 +70,56 @@ contract permits it. Multipart methods accept `Upload` values, and binary
54
70
  download methods return bytes. The client has no automatic retries or
55
71
  pagination; callers retain control of mutation replay and iteration.
56
72
 
73
+ ## Refresh active outcomes during an upgrade
74
+
75
+ The single-session and bulk upgrade methods accept
76
+ `replaceActiveOutcome: true` in their JSON body. It reapplies the target
77
+ version's default rubric to an active outcome, including a caller-defined
78
+ outcome or a session already running that version:
79
+
80
+ ```python
81
+ import os
82
+ from uuid import UUID
83
+
84
+ from recursion_sdk import Recursion, models
85
+
86
+ with Recursion(api_key=os.environ["RECURSION_API_KEY"]) as recursion:
87
+ recursion.managed_agents.replace_session_agent_version(
88
+ session_id=UUID("e3a91f5c-7d24-4b68-9c10-2f8e6b4d7a53"),
89
+ body=models.ReplaceSessionAgentVersionRequest.model_validate({
90
+ "agentVersionId": "5a0c8e37-1f94-4b2d-a6c3-7e9d2b4f8a15",
91
+ "replaceActiveOutcome": True,
92
+ }),
93
+ )
94
+ recursion.managed_agents.start_agent_session_upgrade(
95
+ agent_id=UUID("7b1e4c2a-9d35-4f86-a0c7-5e2d8b3f6a14"),
96
+ idempotency_key="refresh-active-outcomes-1",
97
+ body=models.StartAgentSessionUpgradeRequest.model_validate({
98
+ "replaceActiveOutcome": True,
99
+ }),
100
+ )
101
+ ```
102
+
103
+ While a bulk upgrade is running, a different `replaceActiveOutcome` policy
104
+ returns `409 conflict`; the running upgrade keeps the policy it accepted.
105
+
106
+ `AsyncRecursion` exposes the same calls with `await`. The bulk body is optional;
107
+ leave it out for the usual version-only request. Without the option, inherited
108
+ default outcomes follow the version and caller-defined outcomes stay.
109
+ Explicit replacement requires a nonempty default rubric, preserves the
110
+ objective and pass limit, and retains the prior outcome and grading history as
111
+ `interrupted`. An evaluation in progress finishes before replacement; terminal
112
+ outcomes stay unchanged. A successful upgrade response acknowledges the
113
+ request. Verify the active criteria with `managed_agents.list_session_outcomes`
114
+ after the session's next model operation.
115
+
57
116
  ## Development
58
117
 
59
118
  All Python tooling uses uv. Run these commands from the repository root through
60
119
  the worktree's devbox:
61
120
 
62
121
  ```sh
63
- ./devbox exec -- packages/recursion-python-sdk/tools/uv run --locked --project packages/recursion-python-sdk --group dev --script packages/recursion-python-sdk/tools/check.py
122
+ ./devbox exec -- yarn check recursion:python-sdk
64
123
  ```
65
124
 
66
125
  The package's uv wrapper reuses uv on `PATH` or installs a checksum-verified,
@@ -72,8 +131,8 @@ tests, verifies deterministic generation, builds wheel/sdist artifacts, and
72
131
  checks an isolated installation of the wheel with hashed runtime dependencies
73
132
  from `uv.lock`. Generated files under
74
133
  `src/recursion_sdk/_generated/` are ignored; change the public contract or
75
- generator inputs and rerun the check. `yarn check recursion:python-sdk` invokes
76
- the same command through the repository's check registry.
134
+ generator inputs and rerun the check. It runs `tools/check.py` through uv with
135
+ the materialized preview contract.
77
136
 
78
137
  Python dependencies and generated outputs belong to this independent package.
79
138
  Root Yarn installation, postinstall, JavaScript code generation, and ordinary
@@ -88,9 +147,12 @@ contract. One shared HTTPX transport owns wire behavior and uses JSON Schema
88
147
  validation at its boundaries. No endpoint or request/response model is
89
148
  maintained by hand, and generation requires no JVM or hosted service.
90
149
 
91
- Generation uses the evaluations-enabled snapshot served by production, named
92
- `recursion-public-openapi.preview.generated.json`. Release qualification can
93
- select an exact earlier snapshot with `RECURSION_PYTHON_SDK_CONTRACT_PATH`.
150
+ Generation binds the exact preview audience served by production: the public
151
+ contract source `recursion-public-openapi.preview.generated.json` without its
152
+ `x-recursion-stability` markers. `yarn ci check recursion:python-sdk` and release
153
+ qualification materialize those bytes and pass their path in
154
+ `RECURSION_PYTHON_SDK_CONTRACT_PATH`; the generator requires it and rejects a
155
+ marked source.
94
156
 
95
157
  Build after generation, then add the wheel to your application's uv project:
96
158
 
@@ -106,7 +168,13 @@ process is independent.
106
168
 
107
169
  ## Release
108
170
 
109
- The manual [Python release workflow](../../.github/workflows/release-python-sdk.yml)
171
+ Releases are proposed on Tuesdays and Thursdays and announced in
172
+ #recursion-info while they wait for approval: publishing runs in the `recursion-sdk-pypi`
173
+ environment, which requires an approval from the `recursion` team, and the run
174
+ refuses to publish if it has none. Approving and yanking a bad release:
175
+ [client package releases](../../docs/client-package-releases.md).
176
+
177
+ The [Python release workflow](../../.github/workflows/release-python-sdk.yml)
110
178
  builds and qualifies an explicit version. Its default run only uploads artifacts:
111
179
 
112
180
  ```sh
@@ -147,9 +215,9 @@ checksums, and its source commit.
147
215
 
148
216
  Passing `-f publish=true` to the workflow additionally verifies the source
149
217
  contract in production and publishes those exact archives with `uv publish`
150
- through PyPI trusted publishing. It retains the existing publisher identity:
218
+ through PyPI trusted publishing. Its publisher identity is
151
219
  repository `Labelbox/recursion-platform`, workflow `release-python-sdk.yml`,
152
- environment `publish`, project `labelbox-recursion-sdk`. The final job verifies
220
+ environment `recursion-sdk-pypi`, project `labelbox-recursion-sdk`. The final job verifies
153
221
  PyPI's archive hashes before recording `python-sdk-v<version>` at the source
154
222
  commit. Publication and Git tagging have separate credentials; release runs
155
223
  never commit version changes to the branch.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Typed, synchronous and asynchronous request/response access to the Recursion
4
4
  API. The client and Pydantic models are generated from Recursion's committed
5
- public OpenAPI contract snapshots. Session-event streaming is excluded.
5
+ public OpenAPI contract snapshots. Session-event and gestalt streaming are excluded.
6
6
 
7
7
  The distribution is
8
8
  [`labelbox-recursion-sdk`](https://pypi.org/project/labelbox-recursion-sdk/),
@@ -27,6 +27,22 @@ Set `organization_id` or `tenant_id` on the constructor when the API key
27
27
  requires those selectors. Operation-level selectors may repeat those values;
28
28
  they cannot change the constructor's scope.
29
29
 
30
+ The agent, agent-version, vault, credential, memory-list, agent-template,
31
+ environment, setup-run, environment-template, sandbox-provider, and session
32
+ discovery/overview read methods use
33
+ `/managed-agents/v2` by default. For example,
34
+ `managed_agents.list_agents(limit=50, cursor=...)` returns the v2 page with
35
+ `items`, `nextCursor`, and `total`; `managed_agents.list_environments(limit=50,
36
+ cursor=...)` returns `items` and `nextCursor`; and
37
+ `managed_agents.list_sessions(limit=50, cursor=...)` returns `items`,
38
+ `nextCursor`, and a nullable `total`. The explicit `*_v2` names remain
39
+ available; use `*_v1` to call the deprecated legacy endpoints and receive their
40
+ legacy shapes. Those calls emit `DeprecationWarning` and their docstrings point
41
+ to the v2 replacement. Skill and skill-group methods also use v2 by default,
42
+ including the camelCase request and response models; their explicit `*_v1`
43
+ methods retain the deprecated legacy contracts. Other Managed Agents methods
44
+ use the version declared by the public contract.
45
+
30
46
  Methods return `ApiResponse` with typed `data` and the original HTTPX
31
47
  `response`, including status and headers. A declared bodyless 304 has
32
48
  `data=None`. Declared API errors raise `RecursionAPIError`; malformed or
@@ -42,13 +58,56 @@ contract permits it. Multipart methods accept `Upload` values, and binary
42
58
  download methods return bytes. The client has no automatic retries or
43
59
  pagination; callers retain control of mutation replay and iteration.
44
60
 
61
+ ## Refresh active outcomes during an upgrade
62
+
63
+ The single-session and bulk upgrade methods accept
64
+ `replaceActiveOutcome: true` in their JSON body. It reapplies the target
65
+ version's default rubric to an active outcome, including a caller-defined
66
+ outcome or a session already running that version:
67
+
68
+ ```python
69
+ import os
70
+ from uuid import UUID
71
+
72
+ from recursion_sdk import Recursion, models
73
+
74
+ with Recursion(api_key=os.environ["RECURSION_API_KEY"]) as recursion:
75
+ recursion.managed_agents.replace_session_agent_version(
76
+ session_id=UUID("e3a91f5c-7d24-4b68-9c10-2f8e6b4d7a53"),
77
+ body=models.ReplaceSessionAgentVersionRequest.model_validate({
78
+ "agentVersionId": "5a0c8e37-1f94-4b2d-a6c3-7e9d2b4f8a15",
79
+ "replaceActiveOutcome": True,
80
+ }),
81
+ )
82
+ recursion.managed_agents.start_agent_session_upgrade(
83
+ agent_id=UUID("7b1e4c2a-9d35-4f86-a0c7-5e2d8b3f6a14"),
84
+ idempotency_key="refresh-active-outcomes-1",
85
+ body=models.StartAgentSessionUpgradeRequest.model_validate({
86
+ "replaceActiveOutcome": True,
87
+ }),
88
+ )
89
+ ```
90
+
91
+ While a bulk upgrade is running, a different `replaceActiveOutcome` policy
92
+ returns `409 conflict`; the running upgrade keeps the policy it accepted.
93
+
94
+ `AsyncRecursion` exposes the same calls with `await`. The bulk body is optional;
95
+ leave it out for the usual version-only request. Without the option, inherited
96
+ default outcomes follow the version and caller-defined outcomes stay.
97
+ Explicit replacement requires a nonempty default rubric, preserves the
98
+ objective and pass limit, and retains the prior outcome and grading history as
99
+ `interrupted`. An evaluation in progress finishes before replacement; terminal
100
+ outcomes stay unchanged. A successful upgrade response acknowledges the
101
+ request. Verify the active criteria with `managed_agents.list_session_outcomes`
102
+ after the session's next model operation.
103
+
45
104
  ## Development
46
105
 
47
106
  All Python tooling uses uv. Run these commands from the repository root through
48
107
  the worktree's devbox:
49
108
 
50
109
  ```sh
51
- ./devbox exec -- packages/recursion-python-sdk/tools/uv run --locked --project packages/recursion-python-sdk --group dev --script packages/recursion-python-sdk/tools/check.py
110
+ ./devbox exec -- yarn check recursion:python-sdk
52
111
  ```
53
112
 
54
113
  The package's uv wrapper reuses uv on `PATH` or installs a checksum-verified,
@@ -60,8 +119,8 @@ tests, verifies deterministic generation, builds wheel/sdist artifacts, and
60
119
  checks an isolated installation of the wheel with hashed runtime dependencies
61
120
  from `uv.lock`. Generated files under
62
121
  `src/recursion_sdk/_generated/` are ignored; change the public contract or
63
- generator inputs and rerun the check. `yarn check recursion:python-sdk` invokes
64
- the same command through the repository's check registry.
122
+ generator inputs and rerun the check. It runs `tools/check.py` through uv with
123
+ the materialized preview contract.
65
124
 
66
125
  Python dependencies and generated outputs belong to this independent package.
67
126
  Root Yarn installation, postinstall, JavaScript code generation, and ordinary
@@ -76,9 +135,12 @@ contract. One shared HTTPX transport owns wire behavior and uses JSON Schema
76
135
  validation at its boundaries. No endpoint or request/response model is
77
136
  maintained by hand, and generation requires no JVM or hosted service.
78
137
 
79
- Generation uses the evaluations-enabled snapshot served by production, named
80
- `recursion-public-openapi.preview.generated.json`. Release qualification can
81
- select an exact earlier snapshot with `RECURSION_PYTHON_SDK_CONTRACT_PATH`.
138
+ Generation binds the exact preview audience served by production: the public
139
+ contract source `recursion-public-openapi.preview.generated.json` without its
140
+ `x-recursion-stability` markers. `yarn ci check recursion:python-sdk` and release
141
+ qualification materialize those bytes and pass their path in
142
+ `RECURSION_PYTHON_SDK_CONTRACT_PATH`; the generator requires it and rejects a
143
+ marked source.
82
144
 
83
145
  Build after generation, then add the wheel to your application's uv project:
84
146
 
@@ -94,7 +156,13 @@ process is independent.
94
156
 
95
157
  ## Release
96
158
 
97
- The manual [Python release workflow](../../.github/workflows/release-python-sdk.yml)
159
+ Releases are proposed on Tuesdays and Thursdays and announced in
160
+ #recursion-info while they wait for approval: publishing runs in the `recursion-sdk-pypi`
161
+ environment, which requires an approval from the `recursion` team, and the run
162
+ refuses to publish if it has none. Approving and yanking a bad release:
163
+ [client package releases](../../docs/client-package-releases.md).
164
+
165
+ The [Python release workflow](../../.github/workflows/release-python-sdk.yml)
98
166
  builds and qualifies an explicit version. Its default run only uploads artifacts:
99
167
 
100
168
  ```sh
@@ -135,9 +203,9 @@ checksums, and its source commit.
135
203
 
136
204
  Passing `-f publish=true` to the workflow additionally verifies the source
137
205
  contract in production and publishes those exact archives with `uv publish`
138
- through PyPI trusted publishing. It retains the existing publisher identity:
206
+ through PyPI trusted publishing. Its publisher identity is
139
207
  repository `Labelbox/recursion-platform`, workflow `release-python-sdk.yml`,
140
- environment `publish`, project `labelbox-recursion-sdk`. The final job verifies
208
+ environment `recursion-sdk-pypi`, project `labelbox-recursion-sdk`. The final job verifies
141
209
  PyPI's archive hashes before recording `python-sdk-v<version>` at the source
142
210
  commit. Publication and Git tagging have separate credentials; release runs
143
211
  never commit version changes to the branch.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "labelbox-recursion-sdk"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Typed Python SDK for the Recursion API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "labelbox-recursion-sdk"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Typed Python SDK for the Recursion API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"