Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/agent_env/a2a_agent/a2a_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ async def deploy(
sandbox_type: str | None = None,
sandbox: Sandbox | None = None,
enable_docker: bool = False,
priority: Optional[int] = None,
network_policy: NetworkPolicy | None = None,
*,
attribution: Optional[Attribution] = None,
Expand Down Expand Up @@ -449,7 +448,7 @@ async def deploy(
image_name=image_name, port=a2a_port, env=merged_env,
cpu=cpu, memory=memory, disk_size_gb=disk_size_gb, timeout=ttl_seconds,
attribution=attribution,
priority=priority, network_policy=network_policy,
network_policy=network_policy,
)
self._owns_sandbox = True
logger.info(f"Sandbox created: {self._sandbox.sandbox_id} (mode={self._sandbox.mode})")
Expand Down
6 changes: 2 additions & 4 deletions src/agent_env/cli/a2a_agent/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
help="Sandbox backend(s): a built-in (modal, modal_vm, e2b, local) "
"or a name from [sandbox.providers] in .agentenv/config.toml; comma-separated for a "
"fallback chain. Defaults to [sandbox].agent_default (else local) when omitted.")
@click.option("--priority", type=int, default=0, show_default=True,
help="Sandbox priority: 0=interactive, 1=non_interactive (honoured by backends with priority tiers)")
def deploy(agent_id: str, agent_version: int | None, env_var_pairs: tuple[str, ...], ttl_seconds: int, sandbox: str, priority: int):
def deploy(agent_id: str, agent_version: int | None, env_var_pairs: tuple[str, ...], ttl_seconds: int, sandbox: str):
"""Deploy an A2A agent on a sandbox VM."""
from agent_env.providers import build_sandbox_provider, set_agent_sandbox_provider

Expand All @@ -49,7 +47,7 @@ def deploy(agent_id: str, agent_version: int | None, env_var_pairs: tuple[str, .

click.echo(f"Deploying (ttl={ttl_seconds}s)...")
with run_scope(agent.id):
deployed = asyncio.run(agent.deploy(ttl_seconds=ttl_seconds, env_vars=env_vars if env_vars else None, priority=priority))
deployed = asyncio.run(agent.deploy(ttl_seconds=ttl_seconds, env_vars=env_vars if env_vars else None))

click.echo("Deployed!")
click.echo("Instance ID: " + click.style(deployed.instance_id, fg="green"))
Expand Down
6 changes: 2 additions & 4 deletions src/agent_env/cli/env/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
help="Override default_service_db_env_id (on Modal its images must be in the configured image store)")
@click.option("--gateway", "gateway_env_id", default=None,
help="Override default_gateway_env_id")
@click.option("--priority", type=int, default=0, show_default=True,
help="Sandbox priority: 0=interactive, 1=non_interactive (honoured by backends with priority tiers)")
@click.option("--disk-size-gb", type=float, default=10.0, show_default=True,
help="Sandbox VM disk size in GB. Large universes (e.g. github/gdrive "
"root file trees) need more than the 10GB default.")
Expand All @@ -48,7 +46,7 @@
@click.option("--env-state-instance-id", default=None,
help="Attach against an EXISTING env state instance instead of creating a fresh store "
"(its own type selects the provider).")
def deploy(env_id: str, env_version: int | None, ttl_seconds: int, gateway_mode: str, sandbox: str, service_db_env_id: str | None, gateway_env_id: str | None, priority: int, disk_size_gb: float, cpu: float | None, memory_mb: int | None, env_state_type: str | None, env_state_instance_id: str | None):
def deploy(env_id: str, env_version: int | None, ttl_seconds: int, gateway_mode: str, sandbox: str, service_db_env_id: str | None, gateway_env_id: str | None, disk_size_gb: float, cpu: float | None, memory_mb: int | None, env_state_type: str | None, env_state_instance_id: str | None):
"""Deploy an MCP server environment."""
from agent_env.providers import build_sandbox_provider
from agent_env.config import get_config
Expand All @@ -75,7 +73,7 @@ def deploy(env_id: str, env_version: int | None, ttl_seconds: int, gateway_mode:
cpu_note = f", cpu={cpu}" if cpu else ""
mem_note = f", memory={memory_mb}MB" if memory_mb else ""
click.echo(f"Deploying (ttl={ttl_seconds}s, gateway_mode={mode.value}, disk={disk_size_gb}GB{cpu_note}{mem_note})...")
deploy_kwargs = dict(ttl_seconds=ttl_seconds, gateway_mode=mode, sandbox_type=sandbox, priority=priority, disk_size_gb=disk_size_gb)
deploy_kwargs = dict(ttl_seconds=ttl_seconds, gateway_mode=mode, sandbox_type=sandbox, disk_size_gb=disk_size_gb)
if cpu is not None:
deploy_kwargs["cpu"] = cpu
if memory_mb is not None:
Expand Down
4 changes: 2 additions & 2 deletions src/agent_env/env/envs/mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def from_dict(cls, data: dict) -> MCPServerEnv:
env_provider_type=data.get("env_provider_type", "gateway"),
)

async def deploy(self, ttl_seconds: int = 10800, disk_size_gb: float = 10, gateway_mode: GatewayMode = GatewayMode.PERFORMANCE, cpu: float | None = None, memory_mb: int | None = None, sandbox_type: str | None = None, priority: Optional[int] = None, env_state_type: str | None = None, env_state_instance_id: str | None = None, *, attribution: Optional[Attribution] = None) -> DeployedEnv:
async def deploy(self, ttl_seconds: int = 10800, disk_size_gb: float = 10, gateway_mode: GatewayMode = GatewayMode.PERFORMANCE, cpu: float | None = None, memory_mb: int | None = None, sandbox_type: str | None = None, env_state_type: str | None = None, env_state_instance_id: str | None = None, *, attribution: Optional[Attribution] = None) -> DeployedEnv:
# In container mode the server runs in its own container, so loads stage there, as for a MultiEnv child.
return await deploy_through_provider(
self, environment_name=self.environment_name, ttl_seconds=ttl_seconds, sandbox_type=sandbox_type,
disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb, priority=priority,
disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb,
env_state_type=env_state_type, env_state_instance_id=env_state_instance_id, attribution=attribution,
)

Expand Down
4 changes: 2 additions & 2 deletions src/agent_env/env/envs/multi_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ def from_dict(cls, data: dict) -> "MultiEnv":
return cls(id=data["id"], version=data.get("version"), mcp_server_envs=mcp_server_envs, website_envs=website_envs, metadata=data.get("metadata", {}),
name=data.get("name"), env_provider_type=data.get("env_provider_type", "gateway"))

async def deploy(self, ttl_seconds: int = 10800, disk_size_gb: float = 10, gateway_mode: GatewayMode = GatewayMode.PERFORMANCE, cpu: float | None = None, memory_mb: int | None = None, sandbox_type: str | None = None, priority: Optional[int] = None, env_state_type: str | None = None, env_state_instance_id: str | None = None, *, attribution: Optional[Attribution] = None) -> DeployedEnv:
async def deploy(self, ttl_seconds: int = 10800, disk_size_gb: float = 10, gateway_mode: GatewayMode = GatewayMode.PERFORMANCE, cpu: float | None = None, memory_mb: int | None = None, sandbox_type: str | None = None, env_state_type: str | None = None, env_state_instance_id: str | None = None, *, attribution: Optional[Attribution] = None) -> DeployedEnv:
deployed_env = await deploy_through_provider(
self, environment_name=None, ttl_seconds=ttl_seconds, sandbox_type=sandbox_type,
disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb, priority=priority,
disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb,
env_state_type=env_state_type, env_state_instance_id=env_state_instance_id, attribution=attribution,
)
self._gateway_mode = gateway_mode
Expand Down
4 changes: 2 additions & 2 deletions src/agent_env/env/envs/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def from_dict(cls, data: dict) -> WebsiteEnv:
env_provider_type=data.get("env_provider_type", "gateway"),
)

async def deploy(self, ttl_seconds: int = 10800, disk_size_gb: float = 10, gateway_mode: GatewayMode = GatewayMode.PERFORMANCE, cpu: float | None = None, memory_mb: int | None = None, sandbox_type: str | None = None, priority: Optional[int] = None, env_state_type: str | None = None, env_state_instance_id: str | None = None, *, attribution: Optional[Attribution] = None) -> DeployedEnv:
async def deploy(self, ttl_seconds: int = 10800, disk_size_gb: float = 10, gateway_mode: GatewayMode = GatewayMode.PERFORMANCE, cpu: float | None = None, memory_mb: int | None = None, sandbox_type: str | None = None, env_state_type: str | None = None, env_state_instance_id: str | None = None, *, attribution: Optional[Attribution] = None) -> DeployedEnv:
return await deploy_through_provider(
self, environment_name=self.environment_name, ttl_seconds=ttl_seconds, sandbox_type=sandbox_type,
disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb, priority=priority,
disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb,
env_state_type=env_state_type, env_state_instance_id=env_state_instance_id, attribution=attribution,
)

Expand Down
3 changes: 0 additions & 3 deletions src/agent_env/explorer/routers/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class RunRequest(BaseModel):
context_json: Optional[dict] = None
step_overrides: Optional[dict] = None
overrides: Optional[dict] = None
priority: Optional[int] = None
# Accepted but ignored: the local explorer gets models from the [model] config, not a
# per-request key; declared so a client that always sends them isn't rejected.
litellm_api_key: Optional[str] = None
Expand Down Expand Up @@ -112,8 +111,6 @@ def _run_metadata(body: "RunRequest") -> dict:
# Seed from any user_overrides already in metadata — a re-run inherits the prior
# instance's — so the explicit fields merge into them rather than replacing the lot.
user_overrides = {**(metadata.get("user_overrides") or {}), **(body.overrides or {})}
if body.priority is not None:
user_overrides["priority"] = body.priority
# The steps read `step_params` (TaskStep.step_param_overrides); the request field is
# named differently. Writing the request name through dropped every override.
if body.step_overrides is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ export function StartRunsPanel({
}, [extraOverridesJson]);

const buildOverrides = useCallback((): RunOverrides => {
// priority=0 (interactive): a human watches the live stream. Freeform extras can override (e.g. {"priority":1}); dropdowns win last.
const o = { priority: 0, ...extraOverrides } as RunOverrides;
// Freeform extras first; the dropdowns win.
const o = { ...extraOverrides } as RunOverrides;
if (agentModel.trim()) o.agent_model = agentModel.trim();
if (agentArtifactId.trim()) o.agent_artifact_id = agentArtifactId.trim();
if (a2aAgentId.trim()) o.a2a_agent_id = a2aAgentId.trim();
Expand Down
3 changes: 0 additions & 3 deletions src/agent_env/explorer/ui/src/hooks/useRunGroupPolling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ export interface RunOverrides {
agent_model?: string;
agent_artifact_id?: string;
a2a_agent_id?: string;
/** Sandbox scheduling priority (0=interactive, 1=non_interactive), threaded through
* context.metadata.user_overrides to the deploy task steps' sandbox tier. */
priority?: number;
[k: string]: string | number | boolean | null | undefined;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function main(): Promise<void> {

// The request a run sends.
const body = buildRunBody({ start_step: 2, context_from_instance_id: 'i-1', context_json: { x: 1 } }, 3);
assert(body.version === 3 && body.priority === 0, 'run body: task version, interactive priority');
assert(body.version === 3, 'run body: task version');
Comment thread
polakamtejas marked this conversation as resolved.
assert(body.start_step === 2, 'run body: start step');
assert(body.context_from_instance_id === 'i-1' && !('context_json' in body), 'run body: instance context wins over inline context');
assert(buildRunBody({ version: 5 }, 3).version === 5, 'run body: an explicit version wins');
Expand Down
2 changes: 0 additions & 2 deletions src/agent_env/explorer/ui/src/lib/task-runner-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export function buildRunBody(
): Record<string, unknown> {
const body: Record<string, unknown> = {};
body.version = opts?.version ?? taskVersion ?? undefined;
// priority=0 (interactive): a human is waiting. Sent explicitly so intent survives backend default changes.
body.priority = 0;
if (opts?.start_step != null) body.start_step = opts.start_step;
// Mutually exclusive server-side.
if (opts?.context_from_instance_id)
Expand Down
19 changes: 4 additions & 15 deletions src/agent_env/providers/env_providers/env_gateway_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ async def deploy(
disk_size_gb: float = 10,
cpu: float | None = None,
memory_mb: int | None = None,
priority: Optional[int] = None,
attribution: Optional[Attribution] = None,
) -> DeployedGatewayEnv:
"""A gateway in front of the env, with the state store it acquires (local Postgres by default); returns the record.
Expand All @@ -535,7 +534,7 @@ async def deploy(
sandbox_provider, env.id, state_instance=state_instance, mcp_servers=topology.mcp_servers,
mcp_server_images=topology.mcp_server_images, website_configs=topology.website_configs,
website_images=topology.website_images, mcp_server_name=topology.mcp_server_name, gateway_mode=gateway_mode,
ttl_seconds=ttl_seconds, disk_size_gb=disk_size_gb, cpu=cpu, memory_mb=memory_mb, priority=priority, attribution=attribution,
ttl_seconds=ttl_seconds, disk_size_gb=disk_size_gb, cpu=cpu, memory_mb=memory_mb, attribution=attribution,
)
return DeployedGatewayEnv(
env_id=env.id,
Expand Down Expand Up @@ -567,7 +566,6 @@ async def create_gateway(
disk_size_gb: float = 10,
cpu: float | None = None,
memory_mb: int | None = None,
priority: Optional[int] = None,
existing_sandbox: Sandbox | None = None,
env_id: str | None = None,
state_instance: "EnvStateInstance | None" = None,
Expand All @@ -593,7 +591,7 @@ async def create_gateway(
sandbox_provider, env_id, state_instance=state_instance, mcp_servers=mcp_servers, mcp_server_images=mcp_server_images,
gateway_port=gateway_port, website_configs=website_configs, website_images=website_images,
gateway_mode=gateway_mode, ttl_seconds=ttl_seconds, disk_size_gb=disk_size_gb, cpu=cpu, memory_mb=memory_mb,
priority=priority, existing_sandbox=existing_sandbox, sidecars=sidecars, mcp_server_name=mcp_server_name,
existing_sandbox=existing_sandbox, sidecars=sidecars, mcp_server_name=mcp_server_name,
attribution=attribution,
)

Expand Down Expand Up @@ -621,7 +619,6 @@ async def _deploy_via_vm(
cpu: float | None = None,
memory_mb: int | None = None,
attribution: Optional[Attribution] = None,
priority: Optional[int] = None,
existing_sandbox: Sandbox | None = None,
sidecars: list[SidecarConfig] | None = None,
mcp_server_name: str | None = None,
Expand All @@ -646,7 +643,6 @@ async def _deploy_via_vm(
timeout=ttl_seconds,
disk_size_gb=disk_size_gb,
attribution=attribution,
priority=priority,
**vm_kwargs,
)
sandbox = self._sandbox
Expand Down Expand Up @@ -831,7 +827,6 @@ async def _deploy_via_containers(
cpu: float | None = None,
memory_mb: int | None = None,
attribution: Optional[Attribution] = None,
priority: Optional[int] = None,
mcp_server_name: str | None = None,
) -> DeployedGateway:
from agent_env.env.env import Env
Expand All @@ -848,7 +843,7 @@ async def _deploy_via_containers(
i6pn_kwargs = {"i6pn": True, "region": config.modal_default_region} if isinstance(sandbox_provider, ModalSandboxProvider) else {}
deploy = _ContainerDeploy(
sandbox_provider=sandbox_provider, cpu=cpu, disk_size_gb=disk_size_gb, ttl_seconds=ttl_seconds,
attribution=attribution, priority=priority, i6pn_kwargs=i6pn_kwargs,
attribution=attribution, i6pn_kwargs=i6pn_kwargs,
)

try:
Expand Down Expand Up @@ -936,7 +931,6 @@ async def _deploy_via_containers(
**_size_kwargs(cpu, memory_mb),
disk_size_gb=disk_size_gb, timeout=ttl_seconds,
attribution=attribution,
priority=priority,
**i6pn_kwargs,
)
self._container_sandboxes.append(gateway_sb)
Expand Down Expand Up @@ -1025,7 +1019,6 @@ async def _provision_sidecar(self, deploy: _ContainerDeploy, spec) -> Sandbox:
**_size_kwargs(deploy.cpu, None),
disk_size_gb=deploy.disk_size_gb, timeout=deploy.ttl_seconds,
attribution=deploy.attribution,
priority=deploy.priority,
**deploy.i6pn_kwargs,
)

Expand Down Expand Up @@ -1097,7 +1090,6 @@ async def _stand_up_servicedb(self, deploy: _ContainerDeploy, spec: "LocalPostgr
disk_size_gb=deploy.disk_size_gb, timeout=deploy.ttl_seconds,
expose_externally=False,
attribution=deploy.attribution,
priority=deploy.priority,
**deploy.i6pn_kwargs,
)
self._container_sandboxes.append(db_sb)
Expand Down Expand Up @@ -1130,7 +1122,6 @@ async def _provision_mcp(
**_size_kwargs(deploy.cpu, None),
disk_size_gb=deploy.disk_size_gb, timeout=deploy.ttl_seconds,
attribution=deploy.attribution,
priority=deploy.priority,
**deploy.i6pn_kwargs,
)
return cfg.environment_name, sb
Expand All @@ -1150,7 +1141,6 @@ async def _deploy_gateway(
disk_size_gb: float = 10,
cpu: float | None = None,
memory_mb: int | None = None,
priority: Optional[int] = None,
existing_sandbox: Sandbox | None = None,
sidecars: list[SidecarConfig] | None = None,
mcp_server_name: str | None = None,
Expand All @@ -1166,7 +1156,7 @@ async def _deploy_gateway(
if state_instance is not None
else LocalPostgresStateProvider()
)
deploy_kwargs = {"attribution": dict(attribution or {}), "priority": priority}
deploy_kwargs = {"attribution": dict(attribution or {})}
if isinstance(sandbox_provider, ModalSandboxProvider):
if existing_sandbox is not None:
raise ValueError("existing_sandbox is only supported for VM-mode providers")
Expand Down Expand Up @@ -1352,5 +1342,4 @@ class _ContainerDeploy:
disk_size_gb: float
ttl_seconds: int
attribution: Optional[Attribution]
priority: Optional[int]
i6pn_kwargs: dict
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ async def deploy(
disk_size_gb: float = 10,
cpu: float | None = None,
memory_mb: int | None = None,
priority: Optional[int] = None,
attribution: Optional[Attribution] = None,
) -> DeployedSandboxEnv:
"""The env's MCP server in its own container; returns the record once it serves its card and its tools."""
Expand All @@ -46,7 +45,7 @@ async def deploy(
raise TypeError(f"env_provider_type '{self.type}' deploys one MCP server, not a {env.type} env")
attempt = functools.partial(
self._deploy_server, env, ttl_seconds=ttl_seconds, disk_size_gb=disk_size_gb,
cpu=cpu, memory_mb=memory_mb, priority=priority, attribution=attribution,
cpu=cpu, memory_mb=memory_mb, attribution=attribution,
)
return await self._run(sandbox_provider, env.id, attempt)

Expand All @@ -62,7 +61,6 @@ async def _deploy_server(
disk_size_gb: float,
cpu: float | None,
memory_mb: int | None,
priority: Optional[int],
attribution: Optional[Attribution],
) -> DeployedSandboxEnv:
"""One attempt: the server's container, then its card and tools; returns its record."""
Expand All @@ -80,7 +78,6 @@ async def _deploy_server(
**_size_kwargs(cpu, memory_mb),
disk_size_gb=disk_size_gb, timeout=ttl_seconds,
attribution=dict(attribution or {}),
priority=priority,
)
self._container_sandboxes.append(server)
self._environment_sandboxes[name] = server
Expand Down
2 changes: 1 addition & 1 deletion src/agent_env/providers/env_state/local_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
class ContainerSpec:
"""Declarative spec for a store/sidecar container the compute layer provisions (Modal
path). The gateway's ``create_container`` loop consumes these and adds its own sandbox
knobs (i6pn, attribution, priority)
knobs (i6pn, attribution)
"""

name: str
Expand Down
Loading
Loading