Ephemeral execution environment for external AI agents (OpenClaw, OpenFang) via TextAgent.
- TextAgent creates a GitHub Codespace from this template repo
- The devcontainer runs
scripts/setup.sh→ installs agents + starts the exec API - TextAgent sends commands via
POST /api/exec→ agents execute → results stream back
- User runs
node server.jslocally - On first request with
agentType, the server:- Builds a Docker image from
agents/<type>/Dockerfile - Starts a container with all dependencies pre-installed
- Executes commands inside the container via
docker exec
- Builds a Docker image from
- Containers auto-stop after 10 minutes of idle
- On next request, the existing container is reused (no rebuild)
TextAgent server.js Docker
│ │ │
│─POST {command, │ │
│ agentType:"openclaw"}─▶│ │
│ │─docker build ─────────▶│ (first time only)
│ │─docker run ──────────▶│ (if not running)
│ │─docker exec command──▶│
│ │◀──── stdout/stderr ───│
│◀── {stdout,stderr, │ │
│ exitCode} ──────────│ │
git clone https://github.com/textagent/agent-runner.git
cd agent-runner
node server.jsOutput:
🚀 TextAgent Agent Runner listening on port 8080
🐳 Docker: available
📂 Agents: openclaw, openfang
Then in TextAgent, write:
{{@Agent:
@cloud: no
@agenttype: openclaw
1. List installed Python packages
2. Run the agent on sample data
}}{
"command": "python -c 'print(\"hello from agent\")'",
"agentType": "openclaw",
"context": ""
}Response:
{
"stdout": "hello from agent\n",
"stderr": "",
"exitCode": 0
}- If
agentTypeis specified → runs inside a Docker container - If
agentTypeis empty → runs directly on the host
{
"status": "ok",
"uptime": 123.45,
"docker": true,
"activeAgents": ["openclaw"]
}- Create
agents/<name>/Dockerfile:
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y git
RUN git clone https://github.com/<org>/<agent>.git /app/<name>
RUN pip install -r /app/<name>/requirements.txt
CMD ["tail", "-f", "/dev/null"]-
Create
agents/<name>/requirements.txtwith Python deps -
The server auto-discovers agents with Dockerfiles on startup
agent-runner/
├── .devcontainer/
│ └── devcontainer.json ← Codespaces config
├── agents/
│ ├── openclaw/
│ │ ├── Dockerfile ← Python 3.11 + OpenClaw deps
│ │ └── requirements.txt
│ └── openfang/
│ ├── Dockerfile ← Python 3.11 + OpenFang deps
│ └── requirements.txt
├── scripts/
│ └── setup.sh ← Post-create setup (Codespaces)
├── server.js ← Exec API with Docker lifecycle
├── package.json
├── requirements.txt ← Shared Python deps
└── README.md
- Commands blocked:
rm -rf /,mkfs,dd if=, fork bombs - Agent type validated: alphanumeric + hyphens only
- Each agent runs in an isolated Docker container
- 120s timeout per command, 64 KB max output
- Containers auto-stop after 10 min idle
- Graceful cleanup on SIGINT/SIGTERM
MIT