Skip to content

Writing a Harness Adapter

Sympozium's harness task mode runs an external agent harness as the pod's primary process. An adapter is the image that makes a particular harness fit: it reads the task the way Sympozium supplies it, runs the harness, and hands the answer back on the result contract.

This page describes the v1alpha1 one-shot adapter contract. A persistent adapter uses the separate v1alpha2 openai-chat contract and runs behind a HarnessSession; see the persistent-session guide and the maintained adapter repository's contract.

Sympozium ships no adapters. This page is the contract, so one can be written and maintained without touching this repository or waiting on a Sympozium release. The same division as the Celln backend, where the execution runtime lives in its own repo.

The contract

In

Everything arrives as environment variables and mounted files on an ordinary container.

TASK The task text, from task.parameters.prompt. Falls back to /ipc/input/task.json (.task) when an orchestrator wrote one.
SYSTEM_PROMPT spec.systemPrompt. Honour it only if you declare persona.
MODEL_NAME, MODEL_BASE_URL, MODEL_PROVIDER spec.model. Map these onto whatever your harness reads — see Model routing below.
provider credential Injected per-key by SecretKeyRef from the allowedAuthSecretKeys allowlist (ANTHROPIC_API_KEY, OPENAI_API_KEY, DEEPSEEK_API_KEY, …). Already on the container; never widen the allowlist to make an adapter work.
TOOL_POLICY_ALLOW, TOOL_POLICY_DENY Comma-separated. Honour them only if you declare toolFilter.
MCP_CONFIG_PATH Path to the trusted loopback SkillPack MCP registry, as JSON. Remote operator-configured MCP servers and their credentials are never exposed to an external adapter. A sympozium-skills entry is present when the run has mediated SkillPack tools.
HOME /home/agent, an emptyDir. The only writable path besides /workspace, /ipc/output and /tmp.
SYMPOZIUM_RESULT_PATH Where to write the result. Defaults to /ipc/output/result.json; read it from env rather than hardcoding.
SYMPOZIUM_HARNESS_CONTRACT_VERSION Adapter contract version (v1alpha1 today). Check it at startup and fail closed on unknown versions.
/ipc/control/skip Present when a preRun lifecycle hook skipped the run. Its contents are the skip reason. See Skipped runs.
/workspace The run's PVC, and the container's working directory.
/skills/ Skill files, if the Agent has any.
task.parameters.args Passed through as the container's args. Your ENTRYPOINT receives them as "$@".

You get /ipc/input (read-only), /ipc/control (read-only) and /ipc/output, and no other part of /ipc. The rest of that volume is a control-plane surface — a file dropped in /ipc/spawn creates a sub-agent run, one in /ipc/messages posts to Slack — and an adapter is not a trusted enough writer for it. Do not try to reach those paths; they are not in your mount namespace.

Out

Two things, both required, because two different readers consume them:

  1. $SYMPOZIUM_RESULT_PATH — the ipc-bridge sidecar watches this file and publishes the completion event.
  2. The __SYMPOZIUM_RESULT__ stdout marker — the controller parses this out of the agent container's logs.
__SYMPOZIUM_RESULT__
{"status":"success","response":"...the harness's answer..."}
__SYMPOZIUM_END__

On failure, {"status":"error","error":"..."} and a non-zero exit.

Skipped runs

A preRun lifecycle hook can decide there is no work to do. It writes the marker file /ipc/control/skip and exits 0. With agent-runner, Sympozium reads the marker and skips the LLM call. Your adapter replaces agent-runner, so the adapter must check the marker itself. Sympozium mounts /ipc/control read-only so you can see it. Sympozium does not check it for you.

Check for the file before you start the harness. If it exists, do not start the harness. Emit a skipped result on both outputs, with the file's trimmed contents as response, and exit 0:

__SYMPOZIUM_RESULT__
{"status":"skipped","response":"queue empty"}
__SYMPOZIUM_END__

The controller then moves the AgentRun to the Skipped phase. It bypasses postRun hooks, and a channel-triggered run sends no reply. An empty response is fine: the controller records a default reason. An adapter that ignores the marker runs the harness anyway and spends the tokens the hook tried to save.

Build the payload with a JSON encoder, never string interpolation. Harness output is LLM-generated and adversarial; jq --arg encodes it as a JSON string so it cannot forge a result structure. It cannot forge the marker either — the controller takes the last one in the log, so a mid-run print is overtaken by the real one.

Omit metrics. If your harness does not report real token usage, leave the field out rather than sending zeros: status.tokenUsage stays absent, matching Sympozium's absent-not-zero convention. Reporting zeros claims the run was free.

Image requirements

The pod security context is not relaxed for harness mode, so the image must already fit it:

  • Runs as UID 1000, non-root.
  • readOnlyRootFilesystem: true — write only under $HOME, /workspace, /ipc, /tmp. Anything your harness wants to put in ~/.config or ~/.cache works, because $HOME is the emptyDir; point its own home/state variable there too if it has one.
  • drop: [ALL], RuntimeDefault seccomp.
  • Its own ENTRYPOINT. Sympozium sets no command.

Declaring capabilities honestly

task.parameters.capabilities is currently a comma-separated list of what your image honours: toolFilter, persona, and resume (see Resuming between gate attempts). Claims for outputSchema or subagents are rejected until Sympozium provides a platform-mediated implementation. Sympozium did not build the image and cannot inspect it, so this declaration is the entire basis on which a run is admitted.

Declare only what the adapter actually translates:

  • Too generous — the run is admitted and the field is silently dropped at runtime. This is the failure the whole mechanism exists to prevent, and the one case it cannot catch.
  • Too stingy — working runs are rejected at kubectl apply.

Prefer stingy. A rejection is a message an operator can act on; a silent drop is a policy that quietly does not apply. If your harness has no name-based tool filter, do not declare toolFilter because it has some related-sounding config — check what it actually filters.

Put the reasoning in your adapter's README. The next person to bump the upstream version needs to know which claims were checked against what.

Resuming between gate attempts (resume)

A run with a response gate and lifecycle.retry.inPlace: true can retry on the same run. Each attempt runs in a new pod. The pods share /workspace and $HOME, which are both PVCs, so the next attempt resumes the harness's own session in the same files, and the gate's feedback arrives as the next user turn. Only adapters that declare resume get this. For every other adapter, a retry verdict starts a successor run with a fresh workspace (see In-place retry).

When GATE_IN_PLACE_ENABLED=true, your pod runs one attempt, number GATE_IN_PLACE_START_ATTEMPT (N):

  1. If /gate/verdict-<N-1>.json exists, this attempt is a retry. Resume your harness's session from $HOME, with the verdict's card field as the next user message. Use your harness's own resume flag. If the file does not exist, run the task as usual. /gate is read-only, and the controller is the only writer.
  2. Emit the result as usual, and exit.

The controller starts the gate only after the attempt's pod has ended, every container included. So nothing the model started can change /workspace while the gate checks it, or after. If a container of the pod is still running 10 seconds after your container exits, the controller deletes the pod.

Also note:

  • preRun hooks run only in the first attempt's pod.
  • $HOME is a 1Gi PVC that belongs to the run and is deleted with it. Keep session state there, not in /tmp.
  • Every attempt must run the same image. If the runtime resolves to a different digest between attempts, the run fails.
  • The verdict also carries a mac field. Ignore it: it is for agent-runner. The model runs in your container, so Sympozium never gives you the gate key.
  • The Agent Sandbox backend does not support this. A harness run there uses successor runs.
# In the minimal adapter below, after argv is built. --resume stands for your harness's own
# flag that continues the session it keeps in $HOME.
prev="/gate/verdict-$(( ${GATE_IN_PLACE_START_ATTEMPT:-1} - 1 )).json"
if [ "${GATE_IN_PLACE_ENABLED:-}" = true ] && [ -s "$prev" ]; then
  argv=(my-harness --headless --resume "$(jq -r .card "$prev")")
fi

SkillPack tools come to you as MCP

If the run has SkillPacks that declare tools, the pod runs a Sympozium-owned MCP server on loopback and adds it to the registry at MCP_CONFIG_PATH as sympozium-skills. Connect to it the same way you connect to any other entry — there is nothing adapter-specific to write.

That server holds spec.toolPolicy and applies it at both tools/list and tools/call, and it is the only thing in the pod that can dispatch to a skill sidecar. Its name is protected: sympozium* is a reserved prefix, and an operator mcpServers entry claiming it is rejected, so a registry entry with that name is always the real one. So those tools are policy-enforced regardless of what your adapter does, and you cannot bypass it even if you want to.

Your toolFilter claim still covers your own built-in tools. The two are separate halves of the same AgentRun field.

Model routing is yours

Sympozium sets MODEL_* and injects the model credential (or, under model mediation, a token for the gateway), then stops. Remote MCP credentials are not injected into adapters: a harness run with Agent.spec.mcpServers is rejected until those connections have a trusted local mediator. Sympozium cannot verify that your harness routes to the model the AgentRun names, and many harnesses have opinionated provider resolution — config files, CLI logins, ambient environment — that can quietly win over what you pass.

Map the values explicitly, prefer them over ambient config where the harness lets you, and say in your README what happens if it does not. A harness running against a model the manifest never named still succeeds, which is the worst way for this to be wrong.

Keeping the model key out of the pod

Without mediation, the model shares a container with its provider key, and one shell command reads it. Set harnessPolicy.modelMediation: required on the policy and harnessGateway.enabled in the chart, and the key stays out of the run pod. The harness gateway holds it instead.

An adapter needs no change if its client reads the usual variables. The harness receives:

ANTHROPIC_BASE_URL, OPENAI_BASE_URL, … The gateway, as named by the provider's profile.
MODEL_BASE_URL The same URL. Never the real upstream on a mediated run.
ANTHROPIC_API_KEY, OPENAI_API_KEY, … A per-run token, not the key. It works only through the gateway, only for this run, and only while the run is Pending or Running.
SYMPOZIUM_MODEL_MEDIATED true. The key is a token and the base URL is the gateway, so an adapter that refuses to send a real credential to a third party can tell this case apart.
NODE_EXTRA_CA_CERTS The gateway's CA. A client that isn't Node must be pointed at this file another way. Don't replace the system roots with it, or your tools' calls to the internet stop verifying.

MODEL_PROVIDER_HEADERS is not set. The gateway adds providerHeaders and providerHeadersSecretRef to each request itself.

An adapter that ignores the base URL sends the token to the provider and gets a 401. A client that doesn't trust the CA gets a TLS error. Neither exposes the key.

A mediated run still needs allowUnmetered, because the gateway doesn't measure usage yet.

Limits today:

  • A run that names no authSecretRef has no key to protect, and connects directly.
  • HarnessSession and the Agent Sandbox backend aren't mediated. Under required they fail rather than receive the key.

Provider profiles

A profile says how one family of providers is reached. Profiles are data in the ConfigMap sympozium-harness-gateway-profiles, so adding one needs no release, and it applies to new runs within about 30 seconds. The chart ships anthropic, openai and deepseek. Add others with harnessGateway.profiles. A later entry for a provider replaces an earlier one.

harnessGateway:
  profiles:
    - name: openrouter
      providers: [openrouter]            # values of spec.model.provider
      upstream: https://openrouter.ai/api  # the one origin this profile may reach
      secretKeys: [OPENROUTER_API_KEY, API_KEY]  # first one present in authSecretRef
      auth: {type: header, header: Authorization, prefix: "Bearer "}
      paths: [/v1/chat/completions]      # the allowlist; * matches one segment
      env:
        baseURL: [OPENAI_BASE_URL]       # every name is set
        apiKey: [OPENAI_API_KEY]
      clientBasePath: /v1                # appended to the gateway URL in env.baseURL

Some adapters choose their mode from the key's format. credentials keeps that working, by choosing a variant from the real key's prefix:

credentials:
  - keyPrefix: sk-ant-oat                  # a real key that starts like this...
    fakeKeyPattern: "sk-ant-oat01-{token}" # ...gets a token shaped like this
    auth: {type: header, header: Authorization, prefix: "Bearer "}  # ...and is sent like this
  - keyPrefix: sk-ant-api
    fakeKeyPattern: "sk-ant-api03-{token}"

The first match applies. {token} is random and appears once, and nothing from the key itself reaches the token. The controller shapes the token once, when it mints it. The gateway chooses auth from the key on each call. A key that matches no variant gets the profile's auth and a plain token. The shipped anthropic profile has the two variants above.

A malformed entry is skipped and logged, and its provider then has no profile, so its runs fail. upstream must be https, unless its origin is in harnessGateway.insecureOrigins. A private address also needs harnessGateway.privateOrigins (HTTPS) or insecureOrigins (plain HTTP, which sends the key in clear text). A profile may use only the variable names and auth headers on an allowlist. The chart lists what its own profiles use, in files/harness-gateway/allowed.yaml. Add others with harnessGateway.extraAllowedEnvNames and harnessGateway.extraAllowedAuthHeaders. A variable the controller sets is refused even if listed. The first run to use a key pins it to its origin, and the gateway then sends that key nowhere else.

The gateway puts no time limit on a model call. spec.timeout, RUN_TIMEOUT and LLM_REQUEST_TIMEOUT keep working as they do without it. A call ends when the harness hangs up or when the run stops being Pending or Running.

The gateway answers 503 past harnessGateway.maxConcurrent calls in flight across all runs (32 by default), or past harnessGateway.maxConcurrentPerRun calls for one run (16 by default), with a Retry-After header. A streaming call counts until it ends, so raise these for more concurrent harnesses, or for a run that starts many subagents.

During a rollout, the gateway lets calls in flight finish for harnessGateway.drainSeconds (30 by default). A stream that lasts longer is cut, and the harness has to retry it.

The Agent must list each Secret in spec.authRefs with the run's provider. An entry with no provider doesn't count under required, because a run sets its own provider.

Each profile has one origin, its upstream, and the gateway sends a key nowhere else. spec.model.baseURL may change the path, but a run with any other origin fails, even if its key is already pinned there, because a pin can come from a ModelConnection. privateOrigins and insecureOrigins only say an origin may be reached, not whose keys may go there. To reach another origin, such as a local llama-server, add a profile with its own provider name and that upstream.

providerHeadersSecretRef follows the same rules, because the gateway sends each of its entries upstream. The first run pins this Secret too. A run refused for its Secrets, its origin or its provider pins nothing. A run fails if it is pinned to another origin, or if it holds a key any profile reads as a model key.

A provider's 401, 403 and 407 keep their status, but the body is replaced, because auth errors are where a key gets echoed. Other error bodies pass through the echo check, so a harness can still act on messages such as "prompt is too long". Only Content-Type and the headers listed in allowedResponseHeaders reach the harness. Add others with harnessGateway.extraAllowedResponseHeaders.

A token is bound to the Agent, the key Secret and the origin it was minted for. Recreating the Secret or the Agent, or editing the run to point elsewhere, stops the run's model calls. Rotating the key inside the same Secret does not.

auth.type is header today. AWS SigV4 for Bedrock would be a new type, and needs a release.

The gateway's certificate comes from cert-manager when certManager.enabled is true. Otherwise set harnessGateway.tls.secretName to a Secret with tls.crt, tls.key and ca.crt, valid for harness-gateway.<namespace>.svc.

A minimal adapter

#!/usr/bin/env bash
set -euo pipefail

RESULT_PATH="${SYMPOZIUM_RESULT_PATH:-/ipc/output/result.json}"

emit() {  # $1 = success|error|skipped, $2 = body
  local payload
  payload="$(jq -cn --arg status "$1" --arg body "$2" \
    'if $status == "error" then {status:$status, error:$body}
     else {status:$status, response:$body} end')"
  mkdir -p "$(dirname "$RESULT_PATH")"
  printf '%s' "$payload" > "$RESULT_PATH"
  printf '__SYMPOZIUM_RESULT__\n%s\n__SYMPOZIUM_END__\n' "$payload"
}

if [ -e /ipc/control/skip ]; then   # a preRun hook found no work to do
  emit skipped "$(head -c 2000 /ipc/control/skip)"
  exit 0
fi

TASK_TEXT="${TASK:-}"
if [ -z "$TASK_TEXT" ] && [ -r /ipc/input/task.json ]; then
  TASK_TEXT="$(jq -r '.task // ""' /ipc/input/task.json)"
fi
[ -n "$TASK_TEXT" ] || { emit error "no task supplied"; exit 1; }

argv=(my-harness --headless)
[ -n "${SYSTEM_PROMPT:-}" ] && argv+=(--system-prompt "$SYSTEM_PROMPT")   # declare: persona
argv+=("$@" "$TASK_TEXT")

out="$(mktemp "${TMPDIR:-/tmp}/harness.XXXXXX")"
set +e
"${argv[@]}" 2>&1 | tee "$out"
rc="${PIPESTATUS[0]}"
set -e

if [ "$rc" -ne 0 ]; then
  emit error "harness exited ${rc}: $(tail -c 2000 "$out")"
  exit "$rc"
fi
emit success "$(cat "$out")"

An adapter whose harness is configured by files rather than flags does the same job with one more step: generate the config into $HOME and point the harness at it. Build it with jq too — a generated config that interpolates SYSTEM_PROMPT or an MCP URL by string concatenation is an injection hole.

Publishing one

Adapters are ordinary container images. Publish yours wherever you like and tell operators to add it to SympoziumPolicy.imagePolicy.allowedRegistries by digest. Harness images must be digest-pinned (@sha256:…) — a mutable tag is rejected at admission and by the controller — so publish a stable digest and give operators that, not :latest.

Give them a specific prefix to add, not just the registry host. That list is matched by string prefix, so docker.io/ admits all of Docker Hub while ghcr.io/you/my-harness@sha256: admits only your releases. Ending the entry at a /, a full tag or a digest is what makes it mean what it looks like.

Two things worth putting in the README, because operators cannot discover them from the image:

  • The capability line to use, and why each one is or is not on it.
  • A version-bump check. Upstream harnesses change flags and config formats; a one-command smoke test that proves the adapter still composes is what keeps a bump from becoming a silent behaviour change.

See Also