1
0
mirror of https://github.com/go-micro/go-micro.git synced 2026-06-03 18:44:36 +02:00
Files
Asim Aslam 081e375f29 Add AI provider integration guide and new providers support (#2900)
* docs: add AI provider integration guide and Supported AI Providers section

Add a step-by-step guide for AI infrastructure companies to implement
ai.Model and contribute a provider to go-micro. Covers the full
lifecycle: skeleton, tool call handling, tests, registration, and PR
checklist.

Add a "Supported AI Providers" section to the project README that lists
current providers (Anthropic, OpenAI) in a table and links to the
integration guide with a call-to-action for new providers and sponsors.

Streamline the "Adding a New Provider" section in ai/README.md to point
to the new guide instead of duplicating a full code listing.

* fix: remove nonexistent Discord link from README

* fix(website): set content container width to 800px on desktop

Move the 800px max-width from .markdown-body up to .content so
the entire content pane (not just the inner body) is sized
correctly. The container now fills up to 800px beside the sidebar.

* feat(ai): wire Atlas Cloud into server and auto-detection

Import atlascloud provider in the micro server so it is available
when running micro run / micro server. Add atlascloud to
AutoDetectProvider so --ai_base_url with an atlascloud domain
selects the right provider automatically.

* feat(ai): add Google Gemini provider

Add ai/gemini implementing ai.Model for Google's Gemini API. Uses
the native generateContent endpoint with system_instruction,
contents/parts, and functionDeclarations — not an OpenAI shim.
Default model gemini-2.5-flash, auth via x-goog-api-key header.

Wire into micro server imports and AutoDetectProvider (matches
googleapis.com and google in base URL).

Update README.md and ai/README.md with provider listing.

* feat(ai): add Groq, Mistral, and Together AI providers

Add three new OpenAI-compatible providers:

- ai/groq: ultra-fast inference, default model llama-3.3-70b-versatile
- ai/mistral: Mistral AI, default model mistral-large-latest
- ai/together: Together AI, default model Llama-3.3-70B-Instruct-Turbo

All three are wired into the micro server imports and
AutoDetectProvider. README and ai/README updated with the full
provider table.

* feat(ai): add ai/tools helper and 'micro chat' interactive agent

Extract the registry-discovery + RPC-execution loop from the web
agent playground into a reusable ai/tools package:

- tools.New(reg) creates a Set bound to a registry
- Set.Discover() walks the registry and returns []ai.Tool with
  LLM-safe (underscored) names, remembering the mapping back to
  the original dotted form
- Set.Handler(client) returns an ai.ToolHandler that resolves
  the safe name and issues the RPC

Add cmd/micro/chat — an interactive 'micro chat' REPL that uses
ai/tools to let users talk to their services through any
registered AI provider. Supports --prompt for single-shot use,
auto-detects the provider from --base_url, and falls back to the
provider's conventional env var (ANTHROPIC_API_KEY, etc).

Update README with the new command and the programmatic example.

* feat(examples): add gRPC interop example

Add examples/grpc-interop showing that any standard gRPC client can
call a go-micro service — no go-micro SDK required on the client
side. Includes:

- proto/greeter.proto with generated Go, gRPC, and micro stubs
- server/ using go-micro gRPC transport
- client/ using stock google.golang.org/grpc (no go-micro imports)
- README with Python example and explanation of how routing works

Addresses the confusion from issue #2818 where users didn't know
that go-micro gRPC services are callable by any gRPC client.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-24 18:17:04 +01:00
..
2026-02-11 12:59:18 +00:00

Go Micro Examples

This directory contains runnable examples demonstrating various go-micro features and patterns.

Quick Start

Each example can be run with go run . from its directory.

Examples

hello-world

Basic RPC service demonstrating core concepts:

  • Service creation and registration
  • Handler implementation
  • Client calls
  • Health checks

Run it:

cd hello-world
go run .

web-service

HTTP web service with service discovery:

  • HTTP handlers
  • Service registration
  • Health checks
  • JSON REST API

Run it:

cd web-service
go run .

multi-service

Multiple services in a single binary — the modular monolith pattern:

  • Isolated server, client, store, and cache per service
  • Shared registry and broker for inter-service communication
  • Coordinated lifecycle with service.Group
  • Start monolith, split later when you need to scale independently

Run it:

cd multi-service
go run .

deployment

Docker Compose deployment with MCP gateway, Consul registry, and Jaeger tracing:

  • Production-like architecture in one docker-compose up
  • Standalone MCP gateway connected to service registry
  • Distributed tracing with OpenTelemetry + Jaeger

MCP Examples

See the mcp/ directory for AI agent integration examples:

  • hello - Minimal MCP service (start here)
  • crud - CRUD contact book with full agent documentation
  • workflow - Cross-service orchestration via AI agents
  • documented - All MCP features with auth scopes

agent-demo

Multi-service project management app (Projects, Tasks, Team) with seed data and agent playground integration.

Coming Soon

  • pubsub-events - Event-driven architecture with NATS
  • grpc-integration - Using go-micro with gRPC

Prerequisites

Some examples require external dependencies:

  • NATS: docker run -p 4222:4222 nats:latest
  • Consul: docker run -p 8500:8500 consul:latest agent -dev -ui -client=0.0.0.0
  • Redis: docker run -p 6379:6379 redis:latest

Contributing

To add a new example:

  1. Create a new directory
  2. Add a descriptive README.md
  3. Include working code with comments
  4. Add to this index
  5. Ensure it runs with go run .