internal/website/blog/10.md
May 29, 2026 • By the Go Micro Team
We built micro chat — a CLI that lets you talk to your microservices through an LLM. It discovers every service in the registry, exposes each endpoint as a tool, and lets a model decide which RPCs to call based on what you ask.
ANTHROPIC_API_KEY=sk-ant-... micro chat --provider anthropic
> list all users
→ called users_Users_List({})
There are 3 users: Alice, Bob, and Charlie.
> send a welcome email to Alice
→ called email_Email_Send({"to":"[email protected]","template":"welcome"})
Done, welcome email sent to Alice.
> how many orders were placed this week?
→ called orders_Orders_Count({"since":"2026-05-22"})
There were 47 orders placed this week.
No glue code. No API wrappers. No tool definitions. You write normal Go services with doc comments, and micro chat turns them into things an LLM can call.
Three building blocks, stacked:
1. ai.Tools discovers services from the registry and creates typed tool definitions:
tools := ai.NewTools(service.Registry())
discovered, _ := tools.Discover()
// discovered = []ai.Tool with name, description, parameters for each endpoint
2. ai.History tracks the conversation across turns so the LLM has context:
hist := ai.NewHistory(50)
resp, _ := m.Generate(ctx, &ai.Request{Prompt: "list all users", Tools: discovered, Messages: hist.Messages()})
// Next prompt remembers this exchange
3. ai.Model calls the LLM. Seven providers, same interface:
m := ai.New("anthropic", ai.WithAPIKey(key))
// or: "openai", "gemini", "atlascloud", "groq", "mistral", "together"
micro chat just wires these together with a REPL loop. The whole command is ~170 lines.
micro chat remembers context across turns. You can ask follow-up questions without repeating yourself:
> list all users
There are 3 users: Alice (admin), Bob (user), Charlie (user).
> which ones are admins?
Alice is the only admin.
> change Bob's role to admin too
→ called users_Users_Update({"id":"bob-123","role":"admin"})
Done. Bob is now an admin.
Type reset to clear the conversation history and start fresh. The history limit is 50 messages by default — old messages are dropped FIFO when you hit the limit.
Install or update the CLI:
go install go-micro.dev/v5/cmd/micro@latest
Start your services:
micro run
Chat with them:
# With Anthropic Claude
ANTHROPIC_API_KEY=sk-ant-... micro chat --provider anthropic
# With OpenAI
OPENAI_API_KEY=sk-... micro chat --provider openai
# With Atlas Cloud
ATLASCLOUD_API_KEY=... micro chat --provider atlascloud
# With any provider via base URL
micro chat --provider openai --base_url https://api.groq.com/openai --api_key $KEY
For scripting or one-shot queries, use --prompt:
micro chat --provider anthropic --prompt "list all services"
If you don't want to pass flags every time:
export MICRO_AI_PROVIDER=anthropic
export ANTHROPIC_API_KEY=sk-ant-...
micro chat
The key insight is that go-micro services are already described. The registry stores endpoint names, request/response types, and field metadata. Doc comments on handlers become tool descriptions. @example tags provide usage hints to the LLM.
// CreateUser creates a new user account with the given details.
// @example {"name": "Alice", "email": "[email protected]", "role": "admin"}
func (h *Users) CreateUser(ctx context.Context, req *pb.CreateRequest, rsp *pb.CreateResponse) error {
// ...
}
The ai.Tools package reads all of this from the registry and translates it into the tool format that LLMs understand. The better your doc comments, the better the LLM uses your services.
micro chat is a CLI, but the building blocks work in your own code:
import (
"go-micro.dev/v5/ai"
_ "go-micro.dev/v5/ai/anthropic"
)
tools := ai.NewTools(service.Registry())
discovered, _ := tools.Discover()
m := ai.New("anthropic",
ai.WithAPIKey(key),
ai.WithTools(tools),
)
hist := ai.NewHistory(50)
resp, _ := m.Generate(ctx, &ai.Request{Prompt: userInput, Tools: discovered, Messages: hist.Messages()})
fmt.Println(resp.Answer)
This is the same code micro chat runs internally. Use it to add LLM-powered orchestration to any service.
micro chat is the interactive version. micro flow is the event-driven version — same building blocks, but triggered by broker events instead of human input. See the flows blog post for that story.
Both are experiments in what happens when services are composable by agents, not just by code. The framework provides the building blocks. You decide how to use them.
Go Micro is an open source framework for distributed systems development. Star us on GitHub.
<div class="post-nav"> <div><a href="/blog/9">← From Chat to Flows</a></div> <div><a href="/blog/">All Posts</a></div> </div>