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,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ sandbox:
|
|||
dependencies_mount_path: /opt/dependencies
|
||||
lambda_tools_mount_path: /opt/lambda-tools
|
||||
volume_mount_path: /workspace/volume
|
||||
env: {}
|
||||
|
||||
security:
|
||||
token_header: X-API-Token
|
||||
|
|
|
|||
|
|
@ -40,6 +40,14 @@ sandbox:
|
|||
dependencies_mount_path: /opt/dependencies
|
||||
lambda_tools_mount_path: /opt/lambda-tools
|
||||
volume_mount_path: /workspace/volume
|
||||
env:
|
||||
LANGFUSE_PUBLIC_KEY: pk-lf-
|
||||
LANGFUSE_SECRET_KEY: sk-lf-
|
||||
LANGFUSE_HOST: http://localhost:5000
|
||||
PROVIDER_URL: http://host.docker.internal:8000/v1
|
||||
PROVIDER_API_KEY: "1234"
|
||||
PROVIDER_MODEL: supergemma4-26b-uncensored-mlx-4bit-v2
|
||||
COMPOSIO_API_KEY: ck_r-3c8ClArmcHuSzK5TYu
|
||||
|
||||
security:
|
||||
token_header: X-API-Token
|
||||
|
|
|
|||
|
|
@ -347,6 +347,7 @@ def build_config() -> AppConfig:
|
|||
dependencies_mount_path='/workspace/dependencies',
|
||||
lambda_tools_mount_path='/workspace/lambda-tools',
|
||||
volume_mount_path='/workspace/volume',
|
||||
extra_env={},
|
||||
),
|
||||
security=SecurityConfig(
|
||||
token_header='Authorization',
|
||||
|
|
|
|||
|
|
@ -315,6 +315,7 @@ def build_config(tmp_path: Path) -> SandboxConfig:
|
|||
dependencies_mount_path='/workspace/dependencies',
|
||||
lambda_tools_mount_path='/workspace/lambda-tools',
|
||||
volume_mount_path='/workspace/volume',
|
||||
extra_env={},
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue