Declarative YAML-based framework for defining, managing, and orchestrating AI coding agent instances
Project description
scitex-agent-container
Declarative YAML-based AI agent lifecycle management
pip install scitex-agent-container
Problem
Managing AI coding agents (Claude Code, Cursor, Aider) in production requires manual script-writing, environment setup, and process monitoring for each agent instance. Scaling from one agent to a fleet across multiple machines means duplicating fragile shell scripts with no health checks, restart policies, remote deployment, or inter-agent communication.
Solution
scitex-agent-container provides declarative YAML definitions that fully specify an agent -- runtime, model, MCP servers, environment, health checks, remote host -- started with a single command:
YAML manifest + src_CLAUDE.md + src_mcp.json
|
v
scitex-agent-container start
|
v
tmux/screen session + auto-accept TUI prompts
+ remote SSH deploy
+ health monitor
+ restart policy
Installation
Requires Python >= 3.10.
pip install scitex-agent-container
Quickstart (v2 config)
- Create agent definition directory:
my-agent/
my-agent.yaml # Agent config
src_CLAUDE.md # -> deployed to {workdir}/CLAUDE.md
src_mcp.json # -> deployed to {workdir}/.mcp.json
- Write a YAML manifest:
apiVersion: scitex-agent-container/v2
kind: Agent
metadata:
name: my-agent
labels:
role: worker
machine: local
spec:
runtime: claude-code
model: sonnet
multiplexer: tmux # tmux (default) or screen
claude:
flags:
- --dangerously-skip-permissions
session: new
skills:
required:
- scitex
health:
enabled: true
interval: 60
method: screen-alive
restart:
policy: on-failure
max_retries: 3
v2 auto-derives from metadata.name: workdir, session name, env vars (CLAUDE_AGENT_ID, CLAUDE_AGENT_ROLE, etc.), and pre-start hooks. Sibling src_CLAUDE.md and src_mcp.json files are deployed to the workspace with ${metadata.name} and ${ENV_VAR} interpolation.
- Start and monitor:
scitex-agent-container start my-agent.yaml
scitex-agent-container inspect my-agent # Live state detection
scitex-agent-container status my-agent
scitex-agent-container logs my-agent -n 100
scitex-agent-container attach my-agent # Ctrl-B D to detach (tmux)
Remote SSH Deployment
Deploy agents to remote machines:
spec:
remote:
host: mba # SSH hostname
user: ywatanabe
timeout: 180
scitex-agent-container start remote-agent.yaml # SSHs to remote, launches there
scitex-agent-container stop remote-agent.yaml # Accepts name or YAML path
scitex-agent-container inspect my-remote-agent # Live state from remote
MCP Servers (src_mcp.json)
MCP config lives alongside the YAML as src_mcp.json -- visible, editable, version-controlled:
{
"mcpServers": {
"scitex-orochi": {
"type": "stdio",
"command": "bun",
"args": ["run", "~/proj/scitex-orochi/ts/mcp_channel.ts"],
"env": {
"SCITEX_OROCHI_URL": "wss://scitex-orochi.com",
"SCITEX_OROCHI_AGENT": "${metadata.name}",
"SCITEX_OROCHI_TOKEN": "${SCITEX_OROCHI_TOKEN}"
}
}
}
}
~ in args is expanded at deploy time. ${metadata.name} interpolates from YAML. ${ENV_VAR} resolves from the environment.
Auto-Accept TUI Prompts
Claude Code shows confirmation prompts for dangerous flags. The auto-accept system handles them automatically using modular prompt handlers (runtimes/prompts.py):
# Each handler: detect prompt text -> send number key + Enter
PromptHandler(name="bypass-permissions",
detect=lambda c: "2. Yes, I accept" in c,
keys=["2", "Enter"])
Handlers are order-agnostic, use numbered option text for reliability, and work with both tmux and screen. New prompts are added by appending to PROMPT_HANDLERS.
Diagnostics logged to ~/.scitex/agent-container/logs/{name}/auto-accept.log.
CLI Commands
# Lifecycle (accepts name or YAML path)
scitex-agent-container start <config.yaml>
scitex-agent-container stop <name|yaml>
scitex-agent-container restart <name|yaml>
# Inspection
scitex-agent-container inspect <name> [--json] # Live pane state detection
scitex-agent-container status [name] [--json]
scitex-agent-container list [--json] [--capability X] [--machine Y]
scitex-agent-container logs <name> [-n LINES]
scitex-agent-container health <name> [--json]
scitex-agent-container attach <name>
# Configuration
scitex-agent-container validate <config.yaml>
scitex-agent-container check <config.yaml>
# Maintenance
scitex-agent-container cleanup
YAML Spec Reference
| Section | Key Fields | Description |
|---|---|---|
apiVersion |
scitex-agent-container/v2, cld-agent/v1 |
Config format version |
metadata |
name, labels |
Agent identity and labels |
spec.runtime |
claude-code, cursor, aider |
AI coding tool |
spec.model |
sonnet, opus[1m] |
Model selection |
spec.multiplexer |
tmux (default), screen |
Terminal multiplexer |
spec.remote |
host, user, timeout |
SSH remote deployment |
spec.claude |
flags[], session, auto_accept |
Claude Code options |
spec.health |
enabled, interval, method |
Health monitoring |
spec.restart |
policy, max_retries, backoff |
Auto-restart |
spec.skills |
required[], available[] |
Skill injection |
spec.env |
key-value pairs | Environment variables |
spec.venv |
path | Python virtualenv to activate |
spec.hooks |
pre_start, post_start, pre_stop, post_stop |
Lifecycle hooks |
spec.container |
runtime, image, volumes |
Docker/Apptainer |
Part of SciTeX
scitex-agent-container is part of SciTeX, used as a generic agent lifecycle library by downstream orchestrators like scitex-orochi for multi-machine fleet dispatch.
Four Freedoms for Research
- The freedom to run your research anywhere -- your machine, your terms.
- The freedom to study how every step works -- from raw data to final manuscript.
- The freedom to redistribute your workflows, not just your papers.
- The freedom to modify any module and share improvements with the community.
AGPL-3.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scitex_agent_container-0.7.1.tar.gz.
File metadata
- Download URL: scitex_agent_container-0.7.1.tar.gz
- Upload date:
- Size: 3.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c14c83de50e8d75c8ab991d7194e634b928ef8cad6bd085604dd0d9f8b7a2781
|
|
| MD5 |
a5dcba38040d71886cae43304f1849f9
|
|
| BLAKE2b-256 |
a14b7eb530fe238e07ae17d4b3171e60ddb44549ac2f2429d1593abf3f2e50d8
|
File details
Details for the file scitex_agent_container-0.7.1-py3-none-any.whl.
File metadata
- Download URL: scitex_agent_container-0.7.1-py3-none-any.whl
- Upload date:
- Size: 73.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8e9332b23a2df7609e71d7b3a7ccdb2a93a2b4917cc6f6c4ac01f2ce40ca2ea
|
|
| MD5 |
40ce18f25fb07cb7e16e967d64577813
|
|
| BLAKE2b-256 |
b2448272a1152d36e0db2873444ab0e99f4725a599351580a01136a0fd86368a
|