add sandbox extra env config
This commit is contained in:
parent
32793de992
commit
9ed24b1ae9
7 changed files with 28 additions and 1 deletions
|
|
@ -324,9 +324,24 @@ def _load_sandbox_config(
|
|||
env,
|
||||
'APP_SANDBOX_VOLUME_MOUNT_PATH',
|
||||
),
|
||||
extra_env=_load_sandbox_extra_env(section),
|
||||
)
|
||||
|
||||
|
||||
def _load_sandbox_extra_env(section: Mapping[str, object]) -> dict[str, str]:
|
||||
raw = section.get('env')
|
||||
if raw is None:
|
||||
return {}
|
||||
if not isinstance(raw, dict):
|
||||
raise ConfigError('invalid sandbox.env')
|
||||
result: dict[str, str] = {}
|
||||
for key, value in raw.items():
|
||||
if not isinstance(key, str):
|
||||
raise ConfigError('invalid sandbox.env key')
|
||||
result[key] = str(value)
|
||||
return result
|
||||
|
||||
|
||||
def _load_otel_config(
|
||||
data: Mapping[str, object],
|
||||
env: Mapping[str, str],
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class SandboxConfig:
|
|||
dependencies_mount_path: str
|
||||
lambda_tools_mount_path: str
|
||||
volume_mount_path: str
|
||||
extra_env: dict[str, str]
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class DockerSandboxRuntime(SandboxRuntime):
|
|||
container = self._client.containers.run(
|
||||
self._config.image,
|
||||
detach=True,
|
||||
environment={'AGENT_ID': agent_id},
|
||||
environment={**self._config.extra_env, 'AGENT_ID': agent_id},
|
||||
labels=self._labels(
|
||||
session_id,
|
||||
chat_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue