Skip to main content

zettcode-code-agents

Gateway plugins that run Codex and Claude Code as external agents. Each is a persistent CLI session: the session id is kept in ~/.zettcode/code-agents/ (or $ZETTCODE_CODE_AGENTS_DIR), so every message continues the same conversation.

Install the package beside the gateway and restart it:

pip install zettcode-code-agents

The New page then offers Codex and Claude Code. Both register as kind="external" sessions; the gateway owner can add one to a group, and it can then receive and write there.

A chat on the gateway page sends its text to the CLI as typed, with no request to answer by tool, and the CLI's answer comes back into that chat. A message from a group reaches it framed as a message from the sender and is answered to the sender, not into the group. A picture is refused with a sentence: a headless CLI has nowhere to put one. The gateway only starts an agent. Where it works, how far it is trusted and which command it runs are this plugin's settings, kept in its own file and read again for every message, when its turn starts, so an edit applies to the next message of every agent that is already running, a queued one included. Nothing has to be restarted.

Settings

~/.zettcode/code-agents/config.json (or the file $ZETTCODE_CODE_AGENTS_CONFIG names). Every key is optional:

{
  "cwd": "~/work",
  "permission": "full",
  "timeout": 900,
  "codex": { "cwd": "~/work/api", "permission": "workspace" },
  "claude": { "bin": "/opt/bin/claude" }
}

A key inside "codex" or "claude" wins over the same key at the top, which wins over the environment variable of the same setting, which wins over the default. bin, args and resume_args belong to one tool and are set only inside its section.

Key Default Meaning
cwd the gateway process's directory The folder the CLI runs in. It must exist. A relative path is taken from the gateway process's folder, not from this file's.
permission full How far the agent is trusted: full, workspace or read.
timeout 900 Seconds one turn may take before it is stopped.
bin, args, resume_args see below The command, per tool.

Permission

The default is full: the agent runs on its own and may do anything you may, because nobody is there to answer a prompt. That is the plugin's choice, not the gateway's: starting the gateway with --no-full limits the daemons it starts and does not limit these agents. Set "permission" to workspace or read to narrow them.

permission Codex Claude Code
full --dangerously-bypass-approvals-and-sandbox --permission-mode bypassPermissions
workspace --sandbox workspace-write --permission-mode acceptEdits
read --sandbox read-only --permission-mode plan

codex exec resume takes no --sandbox (checked against codex-cli 0.160.1: it answers "unexpected argument"), so a resumed Codex turn is given the same choice as a configuration override, -c sandbox_mode="workspace-write" (or "read-only"). That flag is accepted by the CLI; that it limits a resumed run the way --sandbox limits the first one has not been verified. If you rely on workspace or read for Codex, send a second message that tries to write outside the folder and see that it is refused, before you trust it.

A setting that cannot be used (invalid JSON, a folder that does not exist, an unknown level, a command that names a word it is not given, or {permission} written inside another word such as --sandbox={permission}) fails that message with a sentence naming the file and the key, in the agent's reply. Mend the file and send again.

Commands

The commands are also configurable from the environment, which the args and resume_args keys override:

Variable Default
ZETTCODE_CODEX_BIN codex
ZETTCODE_CODEX_ARGS exec --json --skip-git-repo-check {permission} {prompt}
ZETTCODE_CODEX_RESUME_ARGS exec resume {session} --json {permission} {prompt}
ZETTCODE_CLAUDE_BIN claude
ZETTCODE_CLAUDE_ARGS {permission} -p {prompt} --output-format json --session-id {session}
ZETTCODE_CLAUDE_RESUME_ARGS {permission} -p {prompt} --output-format json --resume {session}
ZETTCODE_CODE_AGENTS_CWD the gateway process's directory
ZETTCODE_CODE_AGENTS_DIR ~/.zettcode/code-agents
ZETTCODE_CODE_AGENTS_CONFIG config.json in that directory
ZETTCODE_CODE_AGENTS_QUEUE 4 turns waiting (read when the agent starts)
ZETTCODE_CODE_AGENTS_TIMEOUT 900 seconds

Arguments are split with shlex, never run by a shell, and receive {prompt}, {session} and {cwd}. The word {permission} on its own stands for the arguments of the chosen level; a command you write without it is run exactly as written, with no trust arguments added.

The CLIs must be installed and signed in for the user running the gateway.

Metadata

Release files for zettcode-code-agents 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zettcode-code-agents 0.5.1
File Size Uploaded Provenance Actions
zettcode_code_agents-0.5.1.tar.gz 16.4 kB Without provenance Details for zettcode_code_agents-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zettcode-code-agents 0.5.1
File Interpreter ABI Platform Actions
zettcode_code_agents-0.5.1-py3-none-any.whl Python 3 none any Details for zettcode_code_agents-0.5.1-py3-none-any.whl

Total release size: 30.7 kB

Release files / zettcode_code_agents-0.5.1.tar.gz

Download URL zettcode_code_agents-0.5.1.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a76de5de2726fe86c209d35e409c57d87f3ee50eba870adb9c520f0b724cbe2b
BLAKE2b-256 checksum
How to use checksums
d21520fa7cd70482c3c1c82653cd246429f12ba2a3ecc300001b040da2382bf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / zettcode_code_agents-0.5.1-py3-none-any.whl

Download URL zettcode_code_agents-0.5.1-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a836014c50f09bcd9b4db16cb9182b0fdb3d09882bfd2543fe14c81101a2769
BLAKE2b-256 checksum
How to use checksums
1af90ce7ef3f3b37924aa1d868a07a4bcf1ba02b1103f853a1b8b7552894bdf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for zettcode-code-agents 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page