feat(runtime): pluggable agent runtimes (cc / codex)#573
Open
yaozheng-fang wants to merge 2 commits into
Open
Conversation
Introduce a `runtime` selector on `Agent` (`adk` default | `cc` | `codex`) so the inner reasoning/tool loop can be delegated to an external agent harness while the ADK `Runner` keeps owning multi-tenancy, session, memory and tracing. - `veadk/agent.py`: add `runtime` field + a minimal `_run_async_impl` dispatch hook that defers to ADK for `adk` and to `veadk.runtime.get_runtime` otherwise. - `veadk/runtime/base_runtime.py`: `BaseRuntime` ABC + `build_system_append` (appends agent name/description/instruction to the harness system prompt). - `veadk/runtime/__init__.py`: `get_runtime` registry with friendly errors when optional deps are missing. - `cc` (Claude Code SDK): translate session<->events, isolate from `~/.claude` via `setting_sources=[]`, pin the configured model, and bridge OpenAI-compatible endpoints to Anthropic via an in-process litellm shim. - `codex` (OpenAI Codex SDK): isolated `CODEX_HOME` config, Responses<->chat bridge via an in-process litellm shim (Codex only speaks the Responses API). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Disable routing Claude Code to a non-Anthropic model via the in-process Anthropic<->OpenAI shim, pending license/terms review. The cc runtime now accepts only Anthropic-compatible endpoints and raises a clear error for OpenAI-compatible ones. The shim implementation remains in cc/proxy.py so the path can be re-enabled if cleared. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a pluggable runtime layer so an agent's inner reasoning/tool loop can be driven by an external agent harness, while the ADK
Runnerkeeps owning multi-tenancy, session, memory and tracing.What
Agent(runtime=...)selector:"adk"(default, unchanged) |"cc"|"codex".veadk/agent.py: minimal_run_async_impldispatch hook (defers to ADK foradk, else toveadk.runtime.get_runtime).veadk/runtime/base_runtime.py:BaseRuntimeABC +build_system_append(appends agent name/description/instruction to the harness system prompt — append, not replace).veadk/runtime/__init__.py:get_runtimeregistry with friendly errors when optional deps are missing.~/.claude(setting_sources=[]), pin the configured model across all tiers.CODEX_HOMEconfig, Responses<->chat bridge via an in-process litellm shim (Codex only speaks the Responses API).Design notes
Scope
veadk/agent.py+veadk/runtime/**(no examples/docs in this PR).ccneedsclaude-agent-sdk fastapi uvicorn;codexneeds the Codex binary +codex_app_server+fastapi uvicorn.🤖 Generated with Claude Code