Skip to main content

nexus-agent-runner

The generic runtime that executes inside Kubernetes Jobs. Do not create one binary per agent type — the runner receives dynamic config and becomes whatever it describes.

Responsibilities

  • Load run config · Load skills · Load memory
  • Clone repo · Select a backend · Run the agent · Run tools
  • Commit changes · Report logs/events · Return structured output

It reads two env vars — NEXUS_RUN_CONFIG (an AgentRunRequest) and NEXUS_BACKEND_SPEC (a BackendSpec) — then calls build_backend and runs the resulting AgentBackend. The backend (OpenAI/Anthropic API, or the Claude Code / Codex / OpenAI CLI) is chosen from data, so the same image runs any agent.

Stack

LibraryUse
tokioasync runtime
nexus-ai-runtimeAgentBackend trait + API/CLI backends
reqwestHTTP to Nexus Core + LLM providers
serde / serde_jsonconfig + result payloads
schemarsschema for structured output
tracinglogs / spans
async-traitprovider traits
clapCLI args
ductrunning shell tools reliably
tempfilescratch workspaces
ignore / walkdirrepo traversal
similardiffs

Dynamic config

{
"agent_id": "backend-implementer",
"skills": ["rust-backend", "api-testing"],
"memory_scopes": ["project", "agent_private"],
"tools": ["git", "cargo", "shell"],
"task_id": "task_123"
}

So the same runner becomes:

planner-agent · implementer-agent · reviewer-agent · tester-agent · devops-agent

Git inside the container

Use the git CLI inside agent containers for reliability (clone, branch, commit, push). PR creation against GitHub/GitLab is done from Nexus Core via API clients (see crates → nexus-git).

Toolchain images

The runner binary is layered on top of toolchain images from nexus-agent-images (rust, node, python, devops, solana). The agent's runtime.image field selects which.