examples/README.md
This directory contains runnable examples that take you through the Go Micro lifecycle: start with a service, expose it as agent-usable capability, then coordinate work with workflows.
Each example can be run with go run . from its directory unless its README says
otherwise. If you are new to the repo, follow the first-agent path below instead
of reading the directories alphabetically.
| Step | Start here | What you learn | Next step |
|---|---|---|---|
| 1. First service | hello-world | Create and register a basic RPC service, add a handler, call it with a client, and expose health checks. | Move to agent-demo to see services used by an agent. |
| 2. First agent | agent-demo | Run a small project-management app with Projects, Tasks, and Team services plus an agent playground. | Compare with the maintained 0-to-hero path in support. |
| 3. First workflow | support | Follow typed services into an agent chat loop, an event-driven intake flow, and an approval gate in one runnable reference. | Deepen the workflow model with flow-durable. |
For the shortest AI-tooling bridge, the MCP path is
mcp/hello → mcp/crud →
mcp/workflow. For debugging and production hardening, keep
agent-wrap-tool, agent-durable, and
deployment nearby.
Basic RPC service demonstrating core concepts:
Run it:
cd hello-world
go run .
HTTP web service with service discovery:
Run it:
cd web-service
go run .
Multiple services in a single binary — the modular monolith pattern:
service.GroupRun it:
cd multi-service
go run .
Docker Compose deployment with MCP gateway, Consul registry, and Jaeger tracing:
docker-compose upRecommended first agent: a multi-service project management app with Projects, Tasks, and Team services, seed data, and agent playground integration.
The two built-in agent capabilities in a small multi-agent system:
Middleware around an agent's tool execution with AgentWrapTool, the tool-side analogue of client/server wrappers:
Durable agent runs that can be checkpointed and resumed, useful once your first agent needs predictable recovery behavior.
Human-in-the-loop agent interaction for decisions that need an explicit person before the run can continue.
Local-model agent wiring for developers experimenting with Ollama-backed model calls.
A maintained 0-to-hero reference path in one runnable file:
customers, tickets, and notify servicesintake flow and approval gatego test ./examples/supportA workflow as ordered, checkpointed steps that survives a crash and resumes where it stopped:
reserve → charge → confirm), not just one LLM turnResume, completed steps are not re-run (no duplicate side effects)A looping flow example for repeated workflow steps.
See the mcp/ directory for AI agent integration examples:
Authentication and authorization example.
Graceful shutdown behavior for long-running services.
gRPC interoperability example.
Some examples require external dependencies:
docker run -p 4222:4222 nats:latestdocker run -p 8500:8500 consul:latest agent -dev -ui -client=0.0.0.0docker run -p 6379:6379 redis:latestTo add a new example:
go run .