Runs a coding task through a remote webhook that invokes Claude Code or Codex headlessly, then reads back a short spoken result.
- "run coding task"
- "run a coding agent"
- "execute coding task"
- Run any webhook server that accepts
POST /runwith bearer auth (see example below). - In
main.py, replaceWEBHOOK_URLandWEBHOOK_TOKENplaceholders. Use the same token on both sides. - Upload this ability to OpenHome and set trigger words in the dashboard.
If OpenHome can't reach your server directly, use a tunnel (e.g. ngrok http 8080).
The ability sends:
POST /run
Authorization: Bearer <token>
{"prompt": "Add tests for the validator script"}
And expects back:
{"ok": true, "summary": "Added tests and they pass."}Optional response fields: artifact_path, request_id.
The webhook just needs to run Claude Code or Codex and return the output. Swap the command to match your agent.
Safety note: Both examples use autonomous execution flags. Only run in a sandboxed environment or a directory you're comfortable modifying.
# Runs on a separate server, not inside OpenHome.
import subprocess
from flask import Flask, jsonify, request
app = Flask(__name__)
TOKEN = "your-secret-token"
AGENT = "claude" # "claude" or "codex"
WORKDIR = "/path/to/your/project" # sandbox / working directory
def agent_cmd(prompt):
if AGENT == "codex":
return ["codex", "exec", "--full-auto", prompt]
return ["claude", "-p", prompt, "--allowedTools", "Bash,Read,Write,Edit"]
@app.post("/run")
def run():
if request.headers.get("Authorization") != f"Bearer {TOKEN}":
return jsonify(ok=False, error="unauthorized"), 401
prompt = (request.get_json(silent=True) or {}).get("prompt", "").strip()
if not prompt:
return jsonify(ok=False, error="prompt required"), 400
result = subprocess.run(
agent_cmd(prompt),
capture_output=True, text=True, timeout=600, check=False,
cwd=WORKDIR,
)
if result.returncode != 0:
return jsonify(ok=False, error=f"exit code {result.returncode}"), 500
return jsonify(ok=True, summary=result.stdout.strip() or "Done.")User: "run coding task" AI: "Tell me the coding task you'd like to run." User: "Add basic tests for the validator script and run them." AI: "Got it. Want me to run that now?" User: "Yes" AI: "Tests were added and they all pass."
Look for [CodingAgentRunner] entries in OpenHome Live Editor logs.
For demos, static tokens are fine. After testing, rotate on both sides.