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