Why I Build AI Agents in Go (Not Python)
Every AI agent tutorial uses Python. LangChain, LlamaIndex, AutoGen — it's all Python. The ecosystem assumes Python is the only serious choice.
I build my agents in Go. Here's why.
The conventional wisdom
Python wins for AI because:
- The ML ecosystem (transformers, PyTorch, NumPy) is Python-first
- Most API SDKs have Python as the first-class client
- Rapid prototyping is faster
All true. But most of this doesn't apply to what I'm actually building.
What I'm building
I'm not training models. I'm not running inference locally. I'm building orchestration — systems that call LLM APIs, handle responses, route to different tools, maintain state, and integrate with other services.
This is backend engineering, not ML engineering. And Go is excellent at backend engineering.
Go's advantages for agent work
Concurrency that scales naturally
When Asura receives a message, it might need to: check user context (DB query), call Claude API (external HTTP), query an internal service, and format a response — all ideally in parallel. Go's goroutines make this trivial. The same code in Python requires async/await throughout and still feels awkward at scale.
Binary deployment
One binary. No virtualenvs, no pip install, no runtime dependency hell. docker build produces a ~20MB image. This matters when you're the one maintaining the deployment at 2am.
Type safety
API responses are typed. Struct tags handle JSON serialization. When I change a data model, the compiler tells me every place that needs updating. In Python, those errors surface in production.
The SDK situation
Anthropic has an official Go SDK. It handles rate limiting, retries, and streaming — the hard parts.
The trade-offs
I won't pretend there aren't any:
- Verbose error handling —
if err != nileverywhere. I've made peace with it. - Fewer ready-made integrations — I write my own connectors instead of importing LangChain plugins.
- More upfront design — Go makes you think about types before you code. Sometimes I want to just hack something together.
For systems I maintain long-term, these trade-offs are worth it.
The bottom line
If you're experimenting with LLMs, use Python. The ecosystem is unbeatable for exploration.
If you're building systems you'll maintain, that need to be reliable, that integrate with other services — Go is worth the learning curve.
The best tool is the one you trust in production. For me, that's Go.