Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:A5c ai Babysitter k8s job creation

From Leeroopedia
Knowledge Sources
Domains Kubernetes, Job_Dispatch
Last Updated 2026-10-23 00:00 GMT

Overview

Concrete tool for creating and submitting Kubernetes Jobs for agent dispatch with workspace mounts and budget enforcement.

Description

Two methods on the agent dispatch controller (via agentMuxClient) handle K8s Job creation:

  • createAgentJob — Generates a batch/v1 Job manifest from the execution config. The Job mounts the workspace PVC at /workspace, injects env vars (AGENT_MUX_TRANSPORT, TRANSPORT_MUX_CODEC, KRADLE_CALLBACK_URL), and sets activeDeadlineSeconds for budget enforcement.
  • submitAgentJob — Applies the Job manifest to the Kubernetes API, returning the job name and namespace.

Usage

  • Agent dispatch Step 6: Create and submit the K8s Job after all prerequisites are resolved.

Code Reference

Source Location

  • Repository: Babysitter
  • File: packages/kradle/core/src/agent-dispatch-controller.js:L577-594 (createAgentJob), L601-605 (submitAgentJob)

Signature

// Via agentMuxClient
agentMuxClient.createAgentJob(input): { jobManifest, jobName };
// input: { adapter, provider, model, org, runId, stackName, budget,
//   image, serviceAccount, callbackUrl, prompt, env, modelSecretName,
//   workspace, resources, meetingContext }

async agentMuxClient.submitAgentJob(jobManifest): Promise<{ jobName, namespace }>;

Import

import { createAgentDispatchController } from "@a5c-ai/kradle";
// Controller internally creates an agentMuxClient

I/O Contract

Inputs

Name Type Required Description
adapter string Yes Agent adapter name
provider string Yes LLM provider
model string Yes Model ID
runId string Yes Dispatch run name
callbackUrl string Yes Result callback URL
workspace object Yes { pvcName } or { ephemeral: true }
modelSecretName string No Model API key secret

Outputs

Name Type Description
jobManifest object batch/v1 Job manifest
jobName string Job name
namespace string Job namespace

Usage Examples

Create and Submit Agent Job

import { createAgentDispatchController } from "@a5c-ai/kradle";

const controller = createAgentDispatchController();

// After resolving stack, workspace, permissions...
const { jobManifest, jobName } = controller.agentMuxClient.createAgentJob({
  adapter: "claude-code",
  provider: "anthropic",
  model: "claude-sonnet-4-20250514",
  org: "my-org",
  runId: "agent-run-123",
  stackName: "claude-stack",
  budget: { maxTokens: 100000, maxCostUsd: 5.0 },
  image: "ghcr.io/a5c-ai/agent-runner:latest",
  serviceAccount: "agent-sa",
  callbackUrl: "https://kradle.example.com/api/orgs/my-org/agents/runs/agent-run-123/callback",
  prompt: { system: "You are a coding agent.", task: "Fix the bug" },
  env: {},
  modelSecretName: "anthropic-api-key",
  workspace: { pvcName: "kradle-ws-agent-run-123" },
  resources: existingK8sResources,
});

const result = await controller.agentMuxClient.submitAgentJob(jobManifest);
console.log("Submitted job:", result.jobName, "in", result.namespace);

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment