Sandbox clients
BaseSandboxClient
Bases: ABC, Generic[ClientOptionsT]
ソースコード位置: src/agents/sandbox/session/sandbox_client.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
create
abstractmethod
async
create(
*,
snapshot: SnapshotSpec | SnapshotBase | None = None,
manifest: Manifest | None = None,
options: ClientOptionsT,
) -> SandboxSession
Create a new session.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
snapshot
|
SnapshotSpec | SnapshotBase | None
|
Snapshot or spec used to create a snapshot instance for the session. If omitted, the session uses a no-op snapshot. |
None
|
manifest
|
Manifest | None
|
Optional manifest to materialize into the workspace when the session starts. |
None
|
options
|
ClientOptionsT
|
Sandbox-specific settings. For example, Docker expects
|
必須 |
Returns:
A SandboxSession that can be entered with async with or closed explicitly with
await session.aclose().
ソースコード位置: src/agents/sandbox/session/sandbox_client.py
delete
abstractmethod
async
delete(session: SandboxSession) -> SandboxSession
resume
abstractmethod
async
resume(state: SandboxSessionState) -> SandboxSession
Resume an owning session from a previously persisted SandboxSessionState.
Providers should first try to reattach to the backend sandbox identified
by state. If that resource still exists, including after unclean
process/client shutdown where delete() was never called, the returned
session should target the same backend sandbox and be able to clean it
up later.
If the original backend sandbox is unavailable, providers may create a
replacement and should hydrate its workspace from state.snapshot
during SandboxSession.start().
The returned session owns its provider lifecycle; pass a live
session= when you want to reuse an already-running sandbox session.
ソースコード位置: src/agents/sandbox/session/sandbox_client.py
serialize_session_state
serialize_session_state(
state: SandboxSessionState,
) -> dict[str, object]
Serialize backend-specific sandbox state into a JSON-compatible payload.
deserialize_session_state
abstractmethod
deserialize_session_state(
payload: dict[str, object],
) -> SandboxSessionState
Deserialize backend-specific sandbox state from a JSON-compatible payload.
BaseSandboxClientOptions
Bases: BaseModel
Polymorphic base for sandbox client options that need JSON round-trips.