mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-20 00:11:50 +00:00
feat(v2 managed agents): add adapter registry (sandbox_type -> adapter)
This commit is contained in:
parent
9bcea61a3b
commit
d17a704ca9
1 changed files with 25 additions and 0 deletions
25
litellm/managed_agents/adapters/registry.py
Normal file
25
litellm/managed_agents/adapters/registry.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"""Adapter registry — selects the right adapter for a sandbox type.
|
||||
|
||||
Today ships only `"opencode"`. Adding a new sandbox provider means adding
|
||||
a new module under `litellm/managed_agents/adapters/` and registering it
|
||||
here — no other code change is required (the public API stays the same;
|
||||
the `sandbox.type` field selects the adapter).
|
||||
"""
|
||||
|
||||
from litellm.managed_agents.adapters.base import SandboxAdapter
|
||||
from litellm.managed_agents.adapters.opencode import OpencodeAdapter
|
||||
|
||||
# Single shared instance — adapters are stateless, so this is safe and
|
||||
# avoids per-request allocation.
|
||||
_OPENCODE = OpencodeAdapter()
|
||||
|
||||
|
||||
def get_adapter(sandbox_type: str) -> SandboxAdapter:
|
||||
"""Return the adapter for a given `sandbox.type`.
|
||||
|
||||
Raises `ValueError` for unknown sandbox types so the endpoint handler
|
||||
can translate to a 422 response.
|
||||
"""
|
||||
if sandbox_type == "opencode":
|
||||
return _OPENCODE
|
||||
raise ValueError(f"Unknown sandbox type: {sandbox_type!r}")
|
||||
Loading…
Add table
Reference in a new issue