micro--go-micro
307b94aab7
goreleaser / goreleaser (push) Has been cancelled
* feat(a2a): Agent2Agent protocol gateway Add gateway/a2a — exposes registered agents over the open A2A protocol so agents on other frameworks can discover and call them. Agent Cards are generated from registry metadata (the same way the MCP gateway derives tools from service endpoints); incoming A2A tasks translate to the agent's existing Agent.Chat RPC, so there's no per-agent code. v1 is the synchronous JSON-RPC binding: message/send returns a completed Task, tasks/get retrieves it, and Agent Cards are served for discovery; streaming and push notifications are advertised as unsupported. Run with 'micro a2a serve' (cmd/micro/a2a). Tests cover card generation, message/send, tasks/get, listing, and unknown-method errors. * docs: A2A guide, README contents + A2A section, universe A2A check - Add a Contents table of contents at the top of the README and an A2A subsection under Building Agents. - Add the Agent2Agent (A2A) guide and register it in the docs nav. - Exercise the A2A gateway in the universe harness: the concierge agent is reached over A2A (message/send -> Agent.Chat -> completed task). * feat(a2a): outbound client — call external A2A agents Add a2a.Client (Send/Card) so a Go Micro agent or flow can call an agent on any framework by URL — the outbound counterpart to the gateway. Wired in two places: flow.A2A(url) as a workflow step (the cross-framework Dispatch), and agent delegate to an http(s) URL routes over A2A. The universe harness now drives the gateway through the client, exercising both directions. Tests cover client send/card and the round trip. * docs: A2A both-directions — guide, README, changelog, blog #26 --------- Co-authored-by: Claude <noreply@anthropic.com>
11 KiB
11 KiB
Changelog
All notable changes to Go Micro are documented here.
Format follows Keep a Changelog. Go Micro uses calendar-based versions (YYYY.MM) for the AI-native era.
[Unreleased]
Added
- A2A protocol — both directions —
gateway/a2aexposes registered agents over the open Agent2Agent (A2A) protocol so agents on other frameworks can discover and call them: Agent Cards are generated from registry metadata (the same way the MCP gateway derives tools), and incoming tasks are translated to the agent's existingAgent.ChatRPC, with no per-agent code (micro a2a serve). The outbounda2a.Clientcalls external A2A agents by URL, wired intoflow.A2A(url)(a workflow step) anddelegateto anhttp(s)URL (from inside an agent). v1 is the synchronous JSON-RPC binding (message/send,tasks/get, card discovery); streaming and push notifications are advertised as unsupported. (gateway/a2a/,cmd/micro/a2a/) - Agents (
micro.NewAgent) — an agent is a service with an LLM inside: it discovers its assigned services as tools, runs the model's tool loop, registers aChatRPC endpoint, and is reachable like any service.Askfor programmatic use;micro chatdiscovers and routes to agents;micro agent list/describe. (agent/) - Plan & delegate — two built-in agent tools added to every agent:
plan(an ordered, store-persisted plan surfaced back in the prompt) anddelegate(hand a self-contained subtask to a registered agent over RPC, otherwise to an ephemeral sub-agent). No harness or graph — they're plain tools. (agent/builtin.go,examples/agent-plan-delegate/) - Agent guardrails —
MaxSteps(stop on count),LoopLimit(stop repeated no-progress calls; on by default), andApproveTool(human-in-the-loop / policy gate before each action), enforced at the one point every tool call passes through. (agent/, guide + blog) - Pluggable agent memory & custom tools — durable store-backed conversation memory by default, swappable via
AgentMemory; register any function as a tool withAgentTool. - Workflows (
micro.NewFlow) — event-driven orchestration that maps to Anthropic's workflow/agent split: an event triggers a deterministic step (or ordered durable steps), or dispatches to an agent withFlowAgent. (flow/) - x402 payments — opt-in per-call payments for tools via the x402 standard, with a pluggable facilitator and a consumer-side client + budget; the MCP gateway can advertise and require payment per tool. (
wrapper/x402/, guide + blog) - Scoped store state —
store.Scope(s, database, table)returns a store handle that confines every operation to a database/table without mutating the shared store (unlikeInit(Table(...)), which is process-global and races between co-located components). Services, agents, and flows now each keep their state in their own table (service/{name},agent/{name},flow/{name}); the service path replaces the oldInit(store.Table(name))global mutation with a scoped handle. - Flow discovery & history CLI — running flows now register in the registry as
type=flow(and deregister onStop), so they're discoverable like agents:micro flow listshows running flows,micro flow runs <name>shows a flow's durable run history from the store, andmicro agent history <name>shows an agent's stored conversation. Live state comes from the registry; durable history from the scoped store. - Durable workflows — a flow can now be an ordered list of steps (a task with stages) that is checkpointed before and after each step, so a run survives a crash and resumes where it stopped without re-running completed steps. State carries a typed payload plus a
Stagemarker; flow-levelRetrywith a per-step override; runs retained for audit unlessDeleteOnSuccess. Step actions:Call(RPC),LLM(model turn),Dispatch(to an agent), or anyStepFunc. Durability is a pluggableCheckpoint(store-backed by default; implement the interface for Temporal/Restate). Runnable example:examples/flow-durable/. Blog: "Durable Workflows" (internal/website/blog/24.md). - Agent tool-execution wrappers —
AgentWrapToolregisters middleware around an agent's tool calls, the tool-side analogue ofclient.CallWrapper/server.HandlerWrapper. Use it for logging, metrics, retries, or policy; wrappers compose outermost-first and run outside the built-in guardrails. Includes a runnable example with observe + retry wrappers (examples/agent-wrap-tool/). - Agent platform showcase — full platform example (Users, Posts, Comments, Mail) mirroring micro/blog, demonstrating how existing microservices become agent-accessible with zero code changes (
examples/mcp/platform/). - Blog post: "Your Microservices Are Already an AI Platform" — walkthrough of agent-service interaction patterns using real-world services (
internal/website/blog/7.md). - Circuit breakers for MCP gateway — per-tool circuit breakers protect downstream services from cascading failures. Configurable max failures, open-state timeout, and half-open probing. Available via
Options.CircuitBreakerand--circuit-breakerCLI flag (gateway/mcp/circuitbreaker.go). - Helm chart for MCP gateway — official Helm chart at
deploy/helm/mcp-gateway/with Deployment, Service, ServiceAccount, HPA, and Ingress templates. Supports Consul/etcd/mDNS registries, JWT auth, rate limiting, audit logging, per-tool scopes, TLS ingress, and auto-scaling. - MCP gateway benchmarks — comprehensive benchmark suite for tool listing, lookup, auth, rate limiting, and JSON serialization (
gateway/mcp/benchmark_test.go) - Workflow example — cross-service orchestration demo with Inventory, Orders, and Notifications services showing agents chaining multi-step workflows from natural language (
examples/mcp/workflow/) - Docker Compose deployment — production-like setup with Consul registry, standalone MCP gateway, and Jaeger tracing in one
docker-compose up(examples/deployment/)
[2026.03] - March 2026
Added
Developer Experience
micro newMCP templates —micro new myservicegenerates MCP-enabled services with doc comments,@exampletags, andWithMCP()wired in. Use--no-mcpto opt out.micro.New("name")unified API — single way to create services:micro.New("greeter")ormicro.New("greeter", micro.Address(":8080")). Replacesmicro.NewService()+service.New()dual API.service.Handle()simplified registration — register handlers withservice.Handle(new(Greeter))instead of manualserver.NewHandler+server.Handle.micro.NewGroup()modular monoliths — run multiple services in one binary with shared lifecycle:micro.NewGroup(users, orders).Run().mcp.WithMCP()one-liner — add MCP to any service with a single option:micro.New("name", mcp.WithMCP(":3001")).- CRUD example — contact book service with 6 operations, rich agent docs, and validation patterns (
examples/mcp/crud/).
MCP Gateway
- WebSocket transport — bidirectional JSON-RPC 2.0 streaming over WebSocket for real-time agent communication (
gateway/mcp/websocket.go). - OpenTelemetry integration — full span instrumentation across HTTP, stdio, and WebSocket transports with W3C trace context propagation (
gateway/mcp/otel.go). - Standalone gateway binary —
micro-mcp-gatewaywith Docker support for running the MCP gateway independently of services. - Per-tool auth scopes — service-level (
server.WithEndpointScopes()) and gateway-level (Options.Scopes) scope enforcement with bearer token auth. - Rate limiting — per-tool token bucket rate limiting (
Options.RateLimit). - Audit logging — immutable audit records per tool call with trace ID, account, scopes, duration, and errors (
Options.AuditFunc).
AI Model Package
model.Modelinterface — unified AI provider abstraction withGenerate()andStream()methods.- Anthropic Claude provider —
model/anthropicwith tool execution and auto-calling. - OpenAI GPT provider —
model/openaiwith provider auto-detection from base URL.
Agent SDKs
- LangChain SDK —
contrib/langchain-go-micro/Python package with auto-discovery, tool generation, and multi-agent workflow examples. - LlamaIndex SDK —
contrib/go-micro-llamaindex/Python package with RAG integration examples.
Documentation
- AI-native services guide — building services for AI agents from scratch
- MCP security guide — auth, scopes, and audit logging
- Tool descriptions guide — writing doc comments that improve agent performance
- Agent patterns guide — architecture patterns for agent integration
- Error handling guide — writing agent-friendly error responses with typed errors
- Troubleshooting guide — common MCP issues and solutions
- Migration guide — add MCP to existing services in 5 minutes
CLI
micro mcp serve— start MCP server (stdio for Claude Code, HTTP for web agents)micro mcp list— list available tools (human-readable or JSON)micro mcp test— test tools with JSON inputmicro mcp docs— generate tool documentationmicro mcp export— export to LangChain, OpenAPI, or JSON formats
Agent Playground
- Chat-focused UI — redesigned playground with collapsible tool calls, real-time status, and thinking indicators
- Provider settings — configurable OpenAI/Anthropic provider, model, and API key
Changed
- Service interface moved to
service.Servicewithmicro.Serviceas a type alias for backward compatibility. service.New()returnsservice.Serviceinterface (was*ServiceImpl).service.NewGroup()acceptsservice.Serviceinterface (was*ServiceImpl).go.modtemplate inmicro newupdated to Go 1.22.
Fixed
- Handler
Handle()method accepts variadicserver.HandlerOptionfor scopes and metadata. - Store initialization uses service name as table automatically.
- Service
Stop()properly aggregates errors from lifecycle hooks.
[2026.02] - February 2026
Added
- MCP gateway library —
gateway/mcp/with HTTP/SSE and stdio transports, service discovery, tool generation, and JSON schema generation from Go types (2,500+ lines). - CLI integration —
micro run --mcp-addressflag to start MCP alongside services. - Documentation extraction — auto-extract tool descriptions from Go doc comments with
@exampletag and struct tag parsing. - Blog post — "Making Microservices AI-Native with MCP"
- MCP examples —
examples/mcp/hello/andexamples/mcp/documented/
[2026.01] - January 2026
Added
micro deploy— deploy services to any Linux server via SSH + systemd withmicro deploy user@server.micro build— build Go binaries and Docker images withmicro build --docker.- Blog post — "Introducing micro deploy"
For earlier changes, see the git log.