Why We Chose Bash for Agent Orchestration
Mentiko Team
Everyone building agent orchestration reaches for Python. LangChain is Python. CrewAI is Python. AutoGen is Python. The entire ecosystem assumes you'll write your orchestration layer in Python.
We didn't. Mentiko's orchestration layer is bash.
Not because we're contrarian. Because bash is genuinely better for this specific job.
What the orchestration layer actually does
Let's be precise about what we're talking about. The orchestration layer doesn't run the agents -- the agents are whatever CLI tool you choose (Claude Code, Codex, Aider, a custom script). The orchestration layer does four things:
- Reads a chain definition (JSON file)
- Launches agents in PTY sessions
- Watches for event files
- Triggers the next agent when events appear
That's it. Read a file, launch a process, watch a directory, launch another process. This is what bash was designed to do.
The "proper" way would have been worse
We started with a Node.js orchestration layer. It had:
- A process manager with graceful shutdown
- An event bus with pub/sub
- A state machine for chain execution
- Connection pooling for PTY sessions
- Error recovery with exponential backoff
It was 3,000 lines of code. It had 14 dependencies. It took 2 weeks to build and had bugs we were still finding months later. The state machine alone was 400 lines.
The bash replacement is 200 lines across 5 scripts. It has zero dependencies (every Linux/Mac machine has bash). It took an afternoon to write. The bugs are obvious because you can read the entire thing in 10 minutes.
Why bash works here
Launching processes is what shells do. We're not doing computation. We're not manipulating data structures. We're starting processes and waiting for them to finish. Bash has been doing this for 35 years.
File watching is trivial. Our event system is file-based. An agent completes, it writes an .event file. Bash can watch a directory with inotifywait or a simple polling loop. No message queue, no Redis, no pub/sub library. Just files.
Error handling is simple when the scope is small. A bash script that launches one process and checks its exit code is trivially correct. A Python class hierarchy with abstract base methods for error recovery strategies is not.
Debugging is transparent. When something goes wrong, you cat the event file. You ps the process. You tail the log. Every tool your team already knows works out of the box. No debugger, no breakpoints, no stack traces to decode.
What we gave up
Being honest: bash has real limitations.
Testing is harder. We can't unit test bash the way we test TypeScript. Our testing strategy is integration tests -- run a chain, verify the output. It works, but it's not as fine-grained.
Complex logic is painful. Conditional branching in bash is ugly. Our chain runner handles conditions by mapping event names to agent triggers -- the logic stays in the JSON chain definition, not in bash.
No type safety. A typo in a variable name fails silently. We mitigate this with set -euo pipefail at the top of every script, but it's not the same as a type checker.
Hiring perception. Some engineers see bash and assume the project is unsophisticated. We've learned to lead with "the web UI is Next.js/React/TypeScript" and let them discover the bash orchestration layer after they're already impressed.
The lesson
The right tool for a job is the simplest one that works. Not the most powerful. Not the most popular. Not the one with the best ecosystem.
Bash is a terrible language for building web applications. It's a terrible language for data processing. It's a terrible language for most things.
But for "read a file, launch a process, watch a directory, launch another process" -- it's perfect. And that's all agent orchestration is.
We spent two weeks building the Node.js version. We spent an afternoon building the bash version. The bash version is simpler, more reliable, and easier to debug.
Sometimes the unsexy tool is the right tool. We're okay with that.
Want to see the bash orchestration in action? Start with our quick-start tutorial or join the waitlist to try it yourself.
Get new posts in your inbox
No spam. Unsubscribe anytime.