You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6aae4ae
Browse filesBrowse the repository at this point in the historyBrowse files
result =await client.exec(sandbox.name, ["echo", "hello"], workspace="default")
163
+
print(result.stdout)
164
+
165
+
asyncfor page in client.list(workspace="default"):
166
+
for item in page.items:
167
+
print(item.name)
168
+
```
169
+
170
+
List methods return lazy `AsyncPager` objects without an `await`. Use
171
+
`await client.list_all(...)` to collect every page. The provider, sandbox-template,
172
+
and workspace clients also have `Async` counterparts. Authentication settings
173
+
match the synchronous client; credential refresh runs off the event loop.
174
+
175
+
Both sandbox clients accept a caller-configured channel through `from_channel()`.
176
+
That factory borrows the channel: closing the client leaves it open. Clients
177
+
constructed from an endpoint or registered gateway own and close their channels.
178
+
179
+
RPC methods accept `timeout` in seconds to override the client default. This is
180
+
separate from an exec command's `timeout_seconds`. Mutations that support gateway
181
+
deduplication accept `request_id`; reuse the same ID and payload when explicitly
182
+
retrying an uncertain result. Request IDs do not enable general automatic retries. Exec retains the gateway
183
+
owner-route fallback when the route fails before the first response; it never
184
+
replays a command after receiving output.
185
+
186
+
Async task cancellation propagates to the active RPC. For early exit from
187
+
`exec_stream()`, use `contextlib.aclosing()` so the stream is cancelled promptly.
188
+
Gateway RPC failures raise `GatewayError`, preserving the gRPC status and details.
189
+
151
190
## Call Generated RPCs
152
191
153
192
The generated gRPC stubs include concrete request and response types for synchronous `grpc.Channel` and asynchronous `grpc.aio.Channel` connections. Install the dependency type stubs in your development environment for editor signatures and type checking:
Your application configures the channel's TLS and authentication, supplies RPC deadlines, and closes the channel. Create and use async channels on the same event loop. Cancellation and gRPC errors propagate directly. Generated stubs do not reuse `SandboxClient`authentication automatically; `SandboxClient` and `ProviderClient` remain synchronous.
219
+
Your application configures the channel's TLS and authentication, supplies RPC deadlines, and closes the channel. Create and use async channels on the same event loop. Cancellation and gRPC errors propagate directly. Generated stubs do not reuse SDK client authentication automatically. Use `AsyncSandboxClient` for the higher-level async methods and managed authentication.
181
220
182
221
If you annotate a stored async stub explicitly, use a deferred annotation such as `"openshell_pb2_grpc.OpenShellAsyncStub"`. That type exists only in the `.pyi` file; construct `OpenShellStub` at runtime. The same convention applies to credential-driver stubs.
0 commit comments