The request sounded almost too small: use an already-authorized OpenCode installation to ask DeepSeek for “Hello, world!”, then make the result composable, useful, and reliable.

The first call worked. The interesting part started afterwards.

Codex was now driving OpenCode, which was driving DeepSeek. That is an agent running an agent through another provider boundary—and every layer had its own context, permissions, failure modes, cost fields, and opportunities to leak something.

The five-minute discovery

The machine already had OpenCode 1.18.16 and a DeepSeek provider login. The credential lived in OpenCode’s external auth store rather than the repository. We checked its location and file permissions without printing the value, then ran the smallest possible request.

1
2
3
4
5
Codex
  → guarded repository wrapper
    → tool-disabled OpenCode agent
      → authorized DeepSeek route
        → structured text and telemetry

The raw direct-V4-Flash call returned exactly:

1
Hello, world!

That proved connectivity. It did not prove code quality, billing accuracy, safe tool use, or value per accepted task.

What the first comparable probe showed

We then used the same exact prompt—Reply with exactly: probe-ok-42—with a tool-disabled agent. These are AIHackers-owned connection observations from August 11, 2026, not a model benchmark or current route roster:

OpenCode routeExact response?DurationReported costState
deepseek/deepseek-v4-flashYes4.216s$0.00031052validated-probe
deepseek/deepseek-v4-proYes3.785s$0.00097440validated-probe
opencode/deepseek-v4-flash-freeYes18.163s$0validated-probe; exact backend revision unresolved
opencode/laguna-s-2.1-freeYes5.695s$0validated-probe
opencode/longcat-2.0-freeYes24.825s$0validated-probe
opencode/mimo-v2.5-freeYes20.442s$0validated-probe
opencode/nemotron-3-ultra-freeYes23.504s$0validated-probe
opencode/ling-3.0-tiny-freeNo result>30snot recordedunresolved-timeout

“Reported cost” means the value in OpenCode/provider events. It is not a billing-console receipt. A $0 probe does not promise that a route will stay free, identify the hidden backend, or establish its data terms.

The direct Flash route was about three times cheaper than Pro on this tiny request. That is interesting arithmetic and useless buying advice: one exact-string response has no meaningful acceptance burden.

The easy changes that mattered most

The useful implementation was deliberately small:

  1. One restricted agent. OpenCode’s project agent denies every tool. A connectivity or text-transformation call has no reason to edit files, run shell commands, browse, or spawn another agent.
  2. One scriptable interface. Plain text goes to stdout; JSON includes model, finish state, tokens, cache fields, cost, duration, and redaction count.
  3. One hard stop. A timeout terminates the whole child process group. Malformed event streams, explicit error events, missing completion, and non-zero exits fail closed.
  4. No invisible retries. Automatic retries can duplicate both work and charges. The caller decides whether another attempt is justified.
  5. No ambient secrets. The child receives a minimized environment. Credential-shaped prompts are rejected, and model output plus errors are redacted before returning.
  6. A repository gate. Secret scanning runs locally and in publication/CI checks, reporting only file, line, and rule—not the suspicious value.

OpenCode officially supports custom agents and granular allow, ask, and deny permissions. The key design decision was to treat that permission system as part of the API contract, not as a convenient UI setting.

A fresh-worktree check found one wonderfully ordinary bug after the first release: a local node_modules symlink looked like a visible path, so the scanner tried to read a directory as a file. It now ignores symlinks and other non-regular entries instead of following them or crashing. Reliability work is often this unglamorous.

The shortest useful pattern

In this repository, the safe wrapper looks like this:

1
2
3
4
5
6
7
8
# Plain text for shell composition
bun run opencode:ask -- "Reply with exactly: Hello, world!"

# Structured telemetry for a caller
bun run opencode:ask -- --format json "Summarize this public text"

# Explicit route selection
bun run opencode:ask -- --model deepseek/deepseek-v4-pro "Reply briefly"

The reusable idea is broader than these commands:

  • keep provider authentication outside the project;
  • give the nested agent only the permissions required for this call;
  • request a machine-readable event stream;
  • set a real wall-clock timeout;
  • preserve route, version, prompt, duration, attempts, and validation state;
  • never confuse transport telemetry with a receipt or an accepted result.

If the job actually needs repository tools, create a separate narrowly permitted agent and test its allowlist on a disposable worktree. Do not weaken the no-tools probe agent into a general-purpose executor.

Why CAR is still not-run

The repository now has a fail-closed Cost per Accepted Result calculator:

1
CAR = (model/tool cost + human review and cleanup cost) / accepted tasks

It includes failed attempts and returns null when nothing is accepted. What it does not do is manufacture the missing evidence.

A real Flash-versus-Pro decision still needs the same frozen site tasks, commit, harness, permissions, timeout, acceptance rules, reviewer, loaded hourly rate, retries, and redacted billing cross-check. Our next gate is five real tasks per lane, at least four accepted, no unsafe result, CAR no worse than Pro, and a clean-pass gap no larger than one task.

Until that run exists, the result is simple: the connection is validated; the value claim is not-run.

Pro tips from the failure edges

  • Probe identity before capability. A route label is not a model-card guarantee. The historical promotional DeepSeek probe has an unresolved exact backend revision.
  • Separate “free” from “cost recorded as zero.” Access status, provider telemetry, account charge, and future availability are different fields.
  • Make timeouts visible data. Ling’s timeout belongs in the table; silently dropping it would bias the shortlist.
  • Do not benchmark orchestration overhead by accident. OpenCode adds its own system context. Compare candidates through the same agent and harness.
  • Redact twice. Prevent secrets from entering the child, then redact anything suspicious coming back.
  • Keep the agent stack legible. Record which agent called which harness and model. “DeepSeek did it” hides most of the system that produced the output.
  • Spend on acceptance, not demos. A cheap first response can become expensive after retries and cleanup. CAR starts where token-price tables stop.

Remaining issues

  • The August 11 free-route roster, latency, limits, data terms, and backend identities were a dated snapshot and must not be reused as current availability.
  • opencode/ling-3.0-tiny-free needs a fresh bounded preflight before inclusion in any scored run.
  • Provider event costs still need a redacted billing-console cross-check for a publishable CAR result.
  • A future repository-writing comparison needs a separate tool-enabled agent, frozen task pack, independent review, and isolated worktrees.
  • The targeted Git-history secret check found only a known placeholder lineage, but an exhaustive third-party history scan was not available in this run.

That is the real “agents running agents” lesson: delegation is easy to demo. The product is the boundary around it.


Preflight checked August 11, 2026; current Zen routing rechecked August 20. Route availability and reported costs are dated observations; AIHackers-owned DeepSeek CAR remains not-run.