Skip to main content

OpenClaw agent adapter for Harbor — a standalone shim for clean upstream Harbor, until the native integration (harbor-framework/harbor#1490) merges.

Project description

harbor-openclaw

OpenClaw agent adapter for Harbor.

A standalone shim so users on the upstream pip install harbor can run the OpenClaw agent against Harbor tasks today, before the native integration (harbor-framework/harbor#1490) merges.

Install

pip install harbor harbor-openclaw

Usage

harbor run \
  --agent-import-path harbor_openclaw:OpenClaw \
  -p path/to/task \
  -m openai-codex/gpt-5.4

Do not pass -a. Harbor's factory prefers a known -a name over --agent-import-path, so -a nop --agent-import-path harbor_openclaw:OpenClaw would silently run the no-op agent instead of OpenClaw.

Optional runtime env vars (via --ae)

All three are opt-in; omit them for a vanilla API-key run.

Var Purpose
OPENCLAW_AUTH_PROFILES_PATH Path on the host to an auth-profiles.json for OAuth/subscription providers. Base64-injected into $HOME/.openclaw/agents/<id>/agent/auth-profiles.json in the container, then scrubbed at teardown so a leaked image cannot exfiltrate the token.
OPENCLAW_AUTH_B64 Pre-encoded base64 blob of the same auth-profiles.json. Takes precedence over OPENCLAW_AUTH_PROFILES_PATH.
OPENCLAW_MEMORY_DIR Path inside the container to seed into <workspace>/memory/ before the run; openclaw memory index --force is run after seeding (best-effort — falls back to keyword search if the optional vector-index deps aren't installed).
OPENCLAW_PERSONALITY_DIR Path inside the container; files are flat-copied (by basename, -maxdepth 1) into the workspace root — useful for task-supplied AGENTS.md / persona files.

Running with Codex CLI subscription (OAuth)

If you want to run OpenClaw with a Codex model (e.g. openai-codex/gpt-5.4) backed by your ChatGPT subscription, you need an openclaw-format auth-profiles.json on the host containing the OAuth credential.

The fastest path is to reuse the credential the Codex CLI already stored after you logged in with ChatGPT. The Codex CLI keeps it in ~/.codex/auth.json; we re-shape a few fields with jq into the openclaw-format file that this adapter understands. No local OpenClaw install is required.

1. Make sure you've logged into the Codex CLI

After running codex at least once and completing the browser OAuth, ~/.codex/auth.json will exist with tokens.access_token, tokens.refresh_token, tokens.id_token, and tokens.account_id set.

2. Convert ~/.codex/auth.json into openclaw's auth-profiles.json

mkdir -p /tmp/openclaw-auth && jq '{
  version: 1,
  profiles: {
    "openai-codex:default": {
      type: "oauth",
      provider: "openai-codex",
      access: .tokens.access_token,
      refresh: .tokens.refresh_token,
      expires: ((now | floor) * 1000 + 3600000),
      idToken: .tokens.id_token,
      accountId: .tokens.account_id
    }
  }
}' ~/.codex/auth.json > /tmp/openclaw-auth/auth-profiles.json \
  && chmod 600 /tmp/openclaw-auth/auth-profiles.json

Re-run this any time the Codex CLI refreshes its token.

3. Point the adapter at that file

End-to-end command that runs a Harbor task against your subscription:

harbor run \
  --agent-import-path harbor_openclaw:OpenClaw \
  -p path/to/task \
  -m openai-codex/gpt-5.4 \
  --ae OPENCLAW_AUTH_PROFILES_PATH=/tmp/openclaw-auth/auth-profiles.json \
  --ae OPENCLAW_MEMORY_DIR=/app/optional_memory \
  --ae OPENCLAW_PERSONALITY_DIR=/app/persona

Or with a pre-encoded blob:

AUTH_B64=$(base64 -w0 /tmp/openclaw-auth/auth-profiles.json)
harbor run \
  --agent-import-path harbor_openclaw:OpenClaw \
  -p path/to/task \
  -m openai-codex/gpt-5.4 \
  --ae OPENCLAW_AUTH_B64=$AUTH_B64 \
  --ae OPENCLAW_MEMORY_DIR=/app/optional_memory \
  --ae OPENCLAW_PERSONALITY_DIR=/app/persona

If you leave both OPENCLAW_AUTH_PROFILES_PATH and OPENCLAW_AUTH_B64 out and the default file ($HOME/.openclaw/agents/main/agent/auth-profiles.json) exists, the adapter picks it up automatically.

At teardown the adapter scrubs the injected blob from the container so a leaked image can't exfiltrate the OAuth token.

Alternative: Codex via API key

If you'd rather use a metered API key, drop the auth-profiles.json step entirely and pass the key via --ae:

harbor run \
  --agent-import-path harbor_openclaw:OpenClaw \
  -p path/to/task \
  -m openai-codex/gpt-5.4 \
  --ae OPENAI_API_KEY=$OPENAI_API_KEY

Migration after PR merge

Once harbor-framework/harbor#1490 lands on PyPI, you no longer need this package. Drop the --agent-import-path flag and pass -a openclaw:

harbor run -a openclaw -p path/to/task -m openai-codex/gpt-5.4

Development

uv sync --group dev
uv run pytest tests/

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harbor_openclaw-0.1.5.tar.gz (188.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harbor_openclaw-0.1.5-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file harbor_openclaw-0.1.5.tar.gz.

File metadata

  • Download URL: harbor_openclaw-0.1.5.tar.gz
  • Upload date:
  • Size: 188.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for harbor_openclaw-0.1.5.tar.gz
Algorithm Hash digest
SHA256 5b073053983ad31b07f5f3abb2f41349f062e2c579d5722a749b7fdb4d24ac05
MD5 a60c91b25ea11404e622d92d6211d8b3
BLAKE2b-256 d77f47bbe461e80d7ca1b7849491e1d6a338c0f6245162483c2339f4ec00257e

See more details on using hashes here.

File details

Details for the file harbor_openclaw-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: harbor_openclaw-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for harbor_openclaw-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f7871a05d15da598adfe7cf93ffc6a52b3d4f12390b0c9193e62d79e14ec2c2e
MD5 cf0bdb8b88191216fbcdb4a426fdaac3
BLAKE2b-256 a397321109f9e4a5393795b95baab1db258e0271d3fe5e1757f320941558ab22

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page