Overview
Workflow scripts automate multi-agent orchestration patterns. They can launch agents, send messages, wait for events, and coordinate complex tasks. hcom supports both bash and Python scripts, discovered automatically from~/.hcom/scripts/.
Quick Start
Create a Script
Run Your Script
Script Template (Bash)
Complete template with argument parsing and identity handling:Identity Handling
hcom automatically passes--name <identity> to scripts when invoked from inside an agent. Always parse and forward it:
Launching and Tracking Agents
Launch Output Parsing
Launch commands output agent names in the formatNames: <name1>, <name2>:
Cleanup Handler
Track launched agents and clean them up on error:Background vs Interactive Launches
Waiting for Events
Wait for Agent to Go Idle
Wait for Message
Wait for File Change
Example Workflows
Parallel Task Distribution
Sequential Workflow with Handoff
Agent Self-Evaluation
From the bundledconfess.sh script:
Python Scripts
hcom supports Python scripts alongside bash:Script Discovery
User scripts:~/.hcom/scripts/*.{sh,py}
Bundled scripts: Built into hcom binary
confess- Agent self-evaluationdebate- Multi-agent debatefatcow- Codebase oracle
View Script Source
List Available Scripts
Best Practices
- Always handle
--nameflag - Required for scripts to work from inside agents - Use
--goflag - Skip confirmation prompts in automated workflows - Set
--headless- Launch background agents for automation - Track launched agents - Use cleanup handlers to avoid orphans
- Set timeouts - Prevent infinite waits with
--waittimeout - Use tags - Group related agents with
--tagfor batch operations - Validate inputs - Check required arguments before launching agents
- Forward name_arg - Always pass
$name_argto hcom commands - Handle errors - Use
set -euo pipefailand trap cleanup - Add help text - Include usage in
--helphandler