mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
Add a roboco/llm/providers/ seam — an AgentProvider lifecycle ABC and a ProviderRegistry keyed by ModelProvider — so the orchestrator can drive agent backends other than Claude Code. The first non-Claude backend is GrokProvider for xAI's grok-build-0.1. xAI is OpenAI-compatible only (no Anthropic-Messages endpoint), so a Grok agent runs an OpenAI-protocol runtime pointed at https://api.x.ai/v1 rather than the ANTHROPIC_BASE_URL injection the other providers use. It reuses the orchestrator's existing mount/auth assembly, so it inherits the same MCP gateway + tool-manifest wiring as every other agent by construction, and passes its prompt via env (never an argv positional). The change is purely additive: only GROK routes through the registry; Anthropic / Ollama Cloud / self-hosted spawns run the existing _spawn_container path unchanged. Includes: - ModelProvider.GROK (migration 038) + a seeded Grok provider row (migration 039) + a grok-build-0.1 catalog entry - GET/PUT /api/providers/grok-key to store the xAI key (Fernet-encrypted, reusing the existing provider-key machinery) - ClaudeCodeProvider reference adapter over the current spawn - unit tests for the registry, GrokProvider (gateway wiring, no ANTHROPIC_* leak, prompt-injection safety, failure paths) and routing The dedicated roboco-agent-grok image and the exact OpenAI-protocol CLI invocation are the remaining piece to finalise with xAI.
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
"""LLM agent providers.
|
|
|
|
Each provider implements the :class:`AgentProvider` lifecycle for one backend.
|
|
The :class:`ProviderRegistry` maps :class:`~roboco.models.base.ModelProvider`
|
|
values to provider instances; the orchestrator looks a provider up at spawn time
|
|
and falls back to its built-in Claude Code spawn when none is registered.
|
|
|
|
Backends:
|
|
- :class:`ClaudeCodeProvider` — Anthropic-protocol Claude Code container (default;
|
|
also serves Ollama Cloud / self-hosted via ``ANTHROPIC_BASE_URL`` injection).
|
|
- :class:`GrokProvider` — xAI ``grok-build-0.1`` over the OpenAI protocol.
|
|
"""
|
|
|
|
from roboco.llm.providers.base import AgentProvider, ProviderError, SpawnResult
|
|
from roboco.llm.providers.claude_code import ClaudeCodeProvider
|
|
from roboco.llm.providers.grok import GrokProvider
|
|
from roboco.llm.providers.registry import ProviderNotRegisteredError, ProviderRegistry
|
|
|
|
__all__ = [
|
|
"AgentProvider",
|
|
"ClaudeCodeProvider",
|
|
"GrokProvider",
|
|
"ProviderError",
|
|
"ProviderNotRegisteredError",
|
|
"ProviderRegistry",
|
|
"SpawnResult",
|
|
]
|