From bdcda518a7dbf195d907e1bb7c4b3859f633ea05 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 6 May 2026 15:26:23 -0700 Subject: [PATCH] feat: NoopProvider for tests + agent_settings.vm_provider=noop config In-memory `AgentVMProvider` used by the unit tests and as the default when `agent_settings.vm_provider` is unset. The factory returns `NoopProvider` when no AWS-backed provider is configured so the proxy boots cleanly without AWS credentials. LIT-2878 --- .../vm_providers/noop.py | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 litellm/proxy/agent_session_endpoints/vm_providers/noop.py diff --git a/litellm/proxy/agent_session_endpoints/vm_providers/noop.py b/litellm/proxy/agent_session_endpoints/vm_providers/noop.py new file mode 100644 index 00000000000..4ef8a090336 --- /dev/null +++ b/litellm/proxy/agent_session_endpoints/vm_providers/noop.py @@ -0,0 +1,49 @@ +""" +No-op `AgentVMProvider` implementation. + +Used in tests and for environments without an EC2 backend. `provision` returns +a fake handle immediately; `status` always reports `running`. The provider is +the default in `factory.py` so the proxy starts up without AWS configured. +""" + +from __future__ import annotations + +import uuid + +from litellm.proxy.agent_session_endpoints.vm_providers.base import ( + AgentVMProvider, + ProvisionContext, + VMHandle, + VMState, + VMStatus, +) + + +class NoopProvider(AgentVMProvider): + """In-memory provider used by tests and `vm_provider: noop` config.""" + + name = "noop" + + def __init__(self) -> None: + self._terminated: set = set() + + async def provision(self, ctx: ProvisionContext) -> VMHandle: + vm_id = f"noop-{uuid.uuid4().hex[:12]}" + return VMHandle( + vm_id=vm_id, + provider=self.name, + region=(ctx.ec2_config.region if ctx.ec2_config else None), + metadata={ + "session_id": ctx.session_id, + "team_id": ctx.team_id, + "mode": ctx.mode, + }, + ) + + async def terminate(self, vm: VMHandle) -> None: + self._terminated.add(vm.vm_id) + + async def status(self, vm: VMHandle) -> VMStatus: + if vm.vm_id in self._terminated: + return VMStatus(state=VMState.TERMINATED) + return VMStatus(state=VMState.RUNNING, public_ip="127.0.0.1")