Skip to main content

Run Anthropic Claude Code as an optio task; local subprocess or remote via SSH; ttyd-served TUI iframe.

Project description

optio-claudecode

Run Anthropic Claude Code as an optio task — either as a local subprocess or on a remote host over SSH — with the interactive TUI embedded in the optio dashboard via an iframe widget served by ttyd.

Install

pip install optio-claudecode

Requires Python 3.11+. Pulls optio-core, optio-host, and asyncssh.

On task start the package auto-installs the host binaries it needs unless told otherwise:

  • claude — via Anthropic's vendor script (https://claude.ai/install.sh)
  • ttyd — static binary from tsl0922/ttyd GitHub Releases

Quick start

from optio_claudecode import (
    ClaudeCodeTaskConfig,
    create_claudecode_task,
)

def get_tasks():
    return [
        create_claudecode_task(
            process_id="example-task",
            name="Example",
            config=ClaudeCodeTaskConfig(
                consumer_instructions="Please write a haiku about MongoDB.",
                credentials_json=load_user_creds_from_db(user_id),
                # Optional: skip interactive permission prompts for autonomous flows.
                permission_mode="bypassPermissions",
            ),
        )
    ]

credentials_json is treated as an opaque payload and written verbatim to <workdir>/home/.claude/.credentials.json (mode 0600) before claude launches. Format follows whatever Anthropic's CLI currently expects.

How it works

Each task gets a workdir tempdir (/tmp/optio-claudecode-<uuid>/). The ttyd process is launched with HOME=<workdir>/home, so claude reads all its state — credentials, settings, session history — strictly from the per-task workdir and never touches the host user's real ~/.claude/. Two tasks on the same host can run concurrently without shared-state races.

The agent is given a <workdir>/CLAUDE.md that includes the optio.log coordination protocol — STATUS: / DELIVERABLE: / DONE / ERROR — verbatim from optio_host.agents. The same protocol is used by optio-opencode, so the same consumer_instructions can be swapped between the two packages.

See docs/2026-05-28-optio-claudecode-design.md for the full design.

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

optio_claudecode-0.1.2.tar.gz (42.3 kB view details)

Uploaded Source

Built Distribution

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

optio_claudecode-0.1.2-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file optio_claudecode-0.1.2.tar.gz.

File metadata

  • Download URL: optio_claudecode-0.1.2.tar.gz
  • Upload date:
  • Size: 42.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for optio_claudecode-0.1.2.tar.gz
Algorithm Hash digest
SHA256 55c459f727cdb75b8ad935a7b2d99c47870deba109ce1cd8e1d4a937ff672218
MD5 387efa314e57cbc2cef53191f4440bc0
BLAKE2b-256 0c8bb5fee185742c5723808ce20ae66a58f4abc77ca4fa745c9893c943c40f40

See more details on using hashes here.

File details

Details for the file optio_claudecode-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for optio_claudecode-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6c42e2108734e2f5c0a1dccc9fdce7bd0f632c6ddb5d58b4cd7d21869a7c9dd7
MD5 6a995f569d840892af87d68184b2d5c8
BLAKE2b-256 c0d41b3be24d481ce55e42904f0f01a09201059a1c7d83b33dc3fbb0e6897953

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