Why I Love Headless AI Agents: Minecraft and Swarms
Headless AI agents are quietly becoming one of the most useful tools in my whole automation stack. They run without a UI, without a chat session, fully scriptable. Today I want to break down what they actually are, the flags I use most, and the most fun thing I have built with them so far: a Minecraft server where I play co-op with Claude and Codex agents.
Watch the video:
What Headless Means in This Context
Headless just means "no interactive terminal session." You fire a one-shot command, it runs, returns output, exits. The flags that matter:
claude -p "<query>"— Claude Code in headless mode. The whole foundation.codex exec --yolo "<query>"— Codex equivalent. Returns model name, session ID, token usage.opencode run "<query>"— opencode with whichever model you have configured (in my case GLM 5.1).
You can also pass --system-prompt (inline or as a file path) and --model to swap to a different model on the fly. So you can have one agent loop using Sonnet for cheap iteration and another using Opus 4.7 for the hard reasoning steps — same harness, different brain.
The Headless Bridge: Agents Talking to Each Other
The piece I am most excited about is what I call the headless bridge. It is a small relay that lets multiple headless agents stay warm and talk to each other (and to me) in a shared chat. I can spin up two Claude Code instances and two Codex instances, send a message to "all," and watch them collaborate.
I built a token monitor on top of it that tracks input, cache, output, and reasoning tokens per agent in real time, with the equivalent Claude Sonnet API price next to each. I run all of this on my Max plan, so the actual cost is zero — but seeing what it would have cost on the API is a good intuition builder for how cache and reasoning tokens stack up. There is also a turn budget per agent so they cannot go into an infinite "hello — hello back" loop.
This same infrastructure is what powers super-nested Claude Code and the Twitch agent that runs Claude Code on stream — once you can stand up agents headless and pipe messages between them, swarms become trivial.
The Minecraft Swarm
The fun application is Minecraft. I am old, none of my friends play, so I just spin up Claude and Codex as headless agents and let them be my teammates on a private server. The setup:
- Private Minecraft server, version 1.21.11, Java edition
- A custom mod (Claude Code wrote it) that lets the agents read chat and act in-game
- Each agent is a warm
claude -por Codex MCP session that does not exit between turns
I tag the team in chat with commands like "team, come to location -64 152 87" or "team, explore the world, look for sheep" or "Codex, drop log." The agents respond, navigate, mine, hunt — Codex actually went and attacked a horse when I asked for food. Pretty rough on the horse, very fun for me.
I usually sit at base building a shelter while the agents bring back wood, and we cooperate on a workbench, beds, the usual early-game loop. Beats playing alone.
Why This Pattern Matters
The Minecraft demo is silly, but the underlying pattern is not. Once you can:
- Spin up an agent headless
- Keep it warm in a loop
- Let it read input from somewhere (chat, queue, file)
- Let it act through tools
...you can plug that into any environment that has a chat-style interface. Game servers, Discord, Slack, your own apps. The same harness that drives Minecraft bots is what drives the 3-part automation framework for cron-driven workflows.
And because the agents run on my Claude Max subscription, the marginal cost of spinning up a new one is zero. That is the unlock — at zero cost per agent, you can afford to throw a swarm at every problem.
Resources
If you want a follow-up video on the Minecraft setup specifically — the mod, the headless bridge, the message routing — leave a comment on the video and I will put one together.