Implement container runner

t-320.5·WorkTask·
·
·
·Omni/Agentd/Runner.hs
Parent:t-320·Created1 month ago·Updated1 month ago

Dependencies

Description

Edit

Summary

Execute agent in a podman container based on AgentdSpec.

API

data RunConfig = RunConfig
  { runSpec :: AgentdSpec
  , runStdin :: Maybe Text      -- optional stdin to append to task
  , runLogDir :: FilePath       -- where to write logs
  , runRepoRoot :: FilePath     -- repo root to mount readonly
  }

data RunResult = RunResult
  { resultId :: Text            -- run ID
  , resultExitCode :: Int
  , resultLogPath :: FilePath
  }

runAgent :: RunConfig -> IO RunResult

Run ID Format

<YYYYMMDD-HHMMSS>-<spec-basename>-<6-char-hash>

Example: 20250101-143052-deploy-a1b2c3

Podman Invocation

podman run \
  --rm \
  --name <run-id> \
  -v <workspace>:/workspace:rw \
  -v <repo-root>:/repo:ro \
  -v ~/.config/agent:/root/.config/agent:ro \
  -e ANTHROPIC_API_KEY \
  -e OPENROUTER_API_KEY \
  -e KAGI_API_KEY \
  -w /workspace \
  agent-<toolchain> \
  agent \
    --model=<model> \
    --provider=<provider> \
    --max-cost=<cents> \
    --max-iter=<iterations> \
    "<task>"

Note: No skill mounts needed. The agent reads /repo/AGENTS.md for the skill index and loads skills via read_file from /repo/...

Stdin Handling

If stdin provided, append to task:

<original task>

---
Input:
<stdin content>

Logging

  • Stream stdout/stderr to <logdir>/<run-id>/output.log
  • Write metadata to <logdir>/<run-id>/meta.json:

json { "id": "20250101-143052-deploy-a1b2c3", "spec_file": "/path/to/deploy.md", "toolchain": "git", "started_at": "2025-01-01T14:30:52Z", "finished_at": "2025-01-01T14:35:12Z", "exit_code": 0 }

Deliverables

  • [ ] Omni/Agentd/Runner.hs
  • [ ] Proper error handling for podman failures
  • [ ] Log streaming works

Timeline (2)

🔄[human]Open → InProgress1 month ago
🔄[human]InProgress → Done1 month ago