Adds a waiting run state so a flow step can suspend for external input
and resume durably — stage A of the durable-agentic-workflow design in
#4816.
- flow.Await(key, prompt) / flow.AwaitStep(...): a StepFunc that suspends
the run. runFrom recognizes the signal, checkpoints the run with status
"waiting" (recording what it awaits), and returns cleanly — a suspend is
not a failure, and it is not retried or graded.
- Flow.ResumeWith(ctx, runID, input): completes the awaited step with the
injected input (which becomes that step's output state) and continues
from the next step.
- Flow.Waiting(ctx): lists suspended runs with their Await metadata.
- ResumePending/Pending skip waiting runs — they need input, not a
restart. Existing crash-resume (Resume) is unchanged.
Additive: no signature or default-behavior changes. Await ergonomics
(sentinel-return) are the default proposed in #4816; open to AwaitStep-kind
instead if preferred.
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL
Co-authored-by: Claude <noreply@anthropic.com>
A step with no Run function panicked the run; it now returns a clear
configuration error. The retry loop also kept retrying after the run's
context was canceled or its deadline passed — it now stops immediately
and surfaces the context error, preserving cancellation/deadline
semantics for durable workflow runs. Adds regression coverage for both.
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL
Co-authored-by: Claude <noreply@anthropic.com>
Adds the agentic 'loop' to flows: flow.Loop(body, opts...) is a StepFunc
that runs a body step repeatedly, carrying State across passes, until a
stop condition fires or a hard iteration cap is reached.
- Stop modes: flow.Until (code-defined predicate) and flow.UntilLLM (the
model judges the goal met after each pass — the supervised 'Ralph'
loop). Either firing stops the loop.
- flow.LoopMax is the guardrail: the body never runs more than n times, so
the loop always terminates and can't run up an unbounded bill. Hitting
the cap returns the latest state rather than erroring.
- flow.OnIteration reports per-pass progress.
- Composes as a normal flow step (checkpointed by the step engine).
- Exposed at the top level as micro.FlowLoop / FlowUntil / FlowUntilLLM /
FlowLoopMax / FlowOnIteration, symmetric with the other Flow* helpers.
Includes tests, an offline runnable example (examples/flow-loop), an
'Agent Loops' guide, and a CHANGELOG entry.
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL
Co-authored-by: Claude <noreply@anthropic.com>
Fixes#2988. Brings 'golangci-lint run ./...' to zero issues (was ~373):
- errcheck: explicitly ignore fire-and-forget calls with '_ =' (and a small
errcheck.exclude-functions list for response writes — json Encoder.Encode,
http ResponseWriter.Write, fmt.Fprint*); genuine cases handled.
- unused: remove dead code (unexported decls and dead test helpers) and the
imports they orphaned.
- staticcheck: ST1005 error strings, ST1016 receiver names, S1000/S1017/S1019/
S1023 simplifications, SA4004/SA4006/SA4010 dead code, SA1021 net.IP.Equal,
SA6002 (store *[]byte in sync.Pool).
- govet: fix a context leak (lostcancel) in internal/util/mdns and move
t.Fatal/Fatalf out of goroutines (testinggoroutine) in tests.
- ineffassign, unconvert: mechanical fixes.
CI: the Lint workflow now runs a blocking full-tree 'golangci-lint run' on
pushes and PRs (dropped only-new-issues now that the tree is clean).
Verified: go build, go vet, test compilation, and unit tests for the
behaviourally-touched packages all pass.
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL
Co-authored-by: Claude <noreply@anthropic.com>
* test(harness): read agent plan from the scoped store
The store-scoping change moved an agent's plan from the default table
key agent/{name}/plan to its own table (database "agent", table {name},
key "plan"). The plan-delegate harness tests still read the old key and
failed with 'not found'; read through store.Scope(mem, "agent", name)
like the agent does.
* docs: orient agents-first across README, landing, and docs overview
Lead with agents (then services and flows), surface MCP + A2A as the
interop story, and frame agents as services. Landing hero and feature
grid reordered agents-first with an A2A gateway card.
* v6: module path go-micro.dev/v6, TLS secure by default, NewService
Cut v6. Three breaking changes, bundled so the major bump is paid once:
- Module path go-micro.dev/v5 -> go-micro.dev/v6 across all imports + go.mod.
- TLS verification on by default (was off). MICRO_TLS_SECURE removed;
MICRO_TLS_INSECURE=true opts out for self-signed/dev.
- micro.NewService(name, opts...) is the canonical service constructor,
symmetric with NewAgent/NewFlow; micro.New kept as a deprecated alias;
the old name-less NewService(opts...) removed. Generators emit NewService.
Also ports the JWT auth token provider in-module (go-micro.dev/v6/auth/jwt/token
on golang-jwt/jwt/v5), dropping the v5-pinned github.com/micro/plugins/v5/auth/jwt
and the deprecated dgrijalva/jwt-go.
Docs/README/landing updated to v6 and @latest; v5->v6 migration guide added;
CHANGELOG cut as [6.0.0]. Blog posts left at their historical versions.
---------
Co-authored-by: Claude <noreply@anthropic.com>
* 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>
* docs: design note for flow steps + Checkpoint durable execution
* docs: fold in durable-execution decisions (State struct, single Step, run retention, retry)
* docs: rename State.Payload to State.Data
* feat(flow): ordered steps + Checkpoint durable execution
A flow can now be an ordered list of steps (a task with stages) instead
of a single LLM turn. State carries typed Data plus a Stage marker; each
step is checkpointed before and after via a pluggable Checkpoint
(store-backed by default), so a run survives a crash and resumes where it
stopped without re-running completed steps. Flow-level Retry with a
per-step override; runs retained for audit unless DeleteOnSuccess.
Step actions: Call (RPC), LLM (augmented turn), Dispatch (to an agent),
or any StepFunc. Single-step and agent-dispatch flows are unchanged.
* feat(flow): top-level re-exports + durable flow example
Expose the step/checkpoint API from the micro package (FlowSteps,
FlowStep, FlowState, FlowRetry, FlowWithCheckpoint, FlowCall/LLM/Dispatch,
Checkpoint, StoreCheckpoint) and add a runnable, key-free example
demonstrating crash + resume.
* docs: document durable flow steps (guide, README, CLI help)
* docs: blog post + changelog for durable workflows
* fix(flow): scope checkpoint keys by flow name (flow/{name}/runs/{id})
Run keys were flow/runs/{id} — a single global keyspace shared by every
flow on the default store. Namespace them by flow name so each flow's
state is kept apart. StoreCheckpoint now takes a scope argument (the flow
passes its name by default).
* feat(store): Scope handle; scope agent and flow state by name
Add store.Scope(s, database, table) — a store handle that confines every
operation to a database/table without mutating the shared store, so
co-located components don't clobber each other's table (the failure mode
of the global Init(Table(...)) approach).
Use it to keep each agent's memory and plan in its own table
(agent/{name}) and each flow's runs in its own (flow/{name}), instead of
one global table partitioned only by key prefix. Services already scope
by service name.
* feat: consistent state model — service store scoping, flow registry, list/history CLI
- service: scope store via store.Scope (database service / table name),
retiring the Init(store.Table(name)) global-mutation hack; bridge the
default store so handlers using store.DefaultStore stay isolated.
- flow: register in the registry as type=flow while running (with trigger
and step count), deregister on Stop. Live discovery, like agents.
- cli: micro flow list (registry), micro flow runs <name> (durable store),
micro agent history <name> (durable store). list = running, runs/history
= durable, mirroring the service model.
* test: mini-universe end-to-end harness + scheduled GitHub Action
internal/harness/universe boots a small but real go-micro world — four
services, a durable checkout flow that crashes at payment and resumes,
and a guardrailed agent with a tool wrapper reached over RPC — drives the
scenario, asserts the end state (10 checks), and shuts down. Everything
is real except the LLM (mocked), so it's deterministic and needs no key;
-provider anthropic runs it live. Exits non-zero on failure, so it's an
end-to-end test, not just a demo.
Adds .github/workflows/universe.yml (push/PR/daily/dispatch) running the
universe + existing harnesses on the mock provider, plus an opt-in job
that runs live when ANTHROPIC_API_KEY is set. 'make harness' runs them
locally.
* ci: run the live universe job against AtlasCloud (ATLASCLOUD_API_KEY)
* ci: run the live universe job only on schedule or manual dispatch
The deterministic mock job still runs on push/PR/daily; the live
(AtlasCloud) job runs daily and on manual workflow_dispatch only, so
changes don't burn API credits on every PR but can still be checked
against a real model on demand.
---------
Co-authored-by: Claude <noreply@anthropic.com>
* docs: map go-micro onto Anthropic's workflows-vs-agents taxonomy
- new guide 'Agents and Workflows': adopts Anthropic's Building Effective
Agents vocabulary — workflow (predefined path) = flow, agent (dynamic
self-direction) = agent — maps the augmented-LLM building block and the
five workflow patterns onto go-micro, and shows routing (chat router)
and orchestrator-workers (conductor + plan/delegate) are already native.
- flow package doc reframed as a workflow (predefined path) per the same
taxonomy, with guidance on flow vs agent.
- nav + README link the new guide.
* feat: agent guardrails — step limit and tool approval hook
Anthropic's Building Effective Agents stresses stopping conditions and
human-in-the-loop checkpoints for autonomous agents. Add both as plain
options enforced at the tool-handler choke point — no provider changes,
no new abstraction:
- MaxSteps(n): bound tool executions per Ask; beyond the limit, actions
are refused and the model is told to stop and summarize.
- ApproveTool(fn): gate each action before it runs; returning false
blocks it and surfaces the reason to the model. The internal plan tool
is never gated.
Exposed at the micro package (AgentMaxSteps, AgentApproveTool, ApproveFunc).
Tests cover the limit, blocking, and that plan is not gated. Guardrails
section of the agents-and-workflows guide updated from 'active work' to
documented options.
* feat: flow can dispatch to an agent (flow triggers, agent reasons)
Unify the engine without collapsing the workflow/agent distinction. A
Flow with Agent set hands each event's rendered prompt to a named
registered agent over RPC (Agent.Chat) instead of running its own LLM
step — so the workflow stays the deterministic trigger and the agent is
the reasoning engine, with its plan, delegate, memory, and guardrails.
A plain flow is unchanged (single augmented-LLM step).
- flow.Agent(name) / micro.FlowAgent(name); flow stores the client and
skips model setup when dispatching.
- test: dispatch routes to comms.Agent.Chat with the rendered prompt and
records the reply.
- guide: 'Flow triggers, Agent reasons' section.
---------
Co-authored-by: Claude <noreply@anthropic.com>
* docs: Agent interface design sketch
Proposes Agent as a top-level abstraction alongside Service in the
micro package. Agent manages services — scoped tools, system prompt,
conversation memory, registry-discoverable.
Design only, no implementation.
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
* feat: Agent as a first-class abstraction
Introduce micro.NewAgent() alongside micro.New() — Agent is to
intelligence what Service is to capability.
Agent interface:
- Chat(ctx, message) (*Response, error) — core interaction method
- Run() — registers in registry, subscribes to broker, blocks
- Stop() — graceful shutdown
- Scoped tools — only sees endpoints of its assigned services
- Persistent memory — conversation history stored in store
- Agent-to-agent — communication via broker topics
Top-level API:
agent := micro.NewAgent("task-mgr",
micro.AgentServices("task"),
micro.AgentPrompt("You manage tasks."),
micro.AgentProvider("anthropic"),
)
agent.Run()
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
* feat: wire agents into chat router, add micro agent CLI, expose Flow
Three top-level abstractions:
micro.New("task") — Service (capability)
micro.NewAgent("task-mgr") — Agent (intelligence)
micro.NewFlow("onboard-user") — Flow (event-driven orchestration)
micro chat as router:
- Discovers agents from registry on startup
- Single agent: routes directly
- Multiple agents: LLM classifies intent, dispatches to right agent
via route_to_agent tool
- No agents: falls back to current direct-service behaviour
- Banner shows discovered agents
micro agent CLI:
- micro agent list — shows registered agents and their services
- micro agent describe <name> — shows agent details from registry
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
* feat: move flow to top level, update docs for three abstractions
Package structure now consistent:
service/ — Service (capability)
agent/ — Agent (intelligence)
flow/ — Flow (event-driven orchestration)
ai/flow/ kept as backward-compatible re-export.
Updated across all surfaces:
- CLAUDE.md: added agent/ and flow/ to project structure
- README: added "Building Agents" section with NewAgent() examples,
updated features table (Agents, Flows, Chat router), CLI table
(agent list, agent describe), docs links
- Website: features grid shows Services, Agents, Flows as the three
pillars alongside generation, MCP, and pluggable architecture
- micro.go: Flow imported from top-level flow/ package
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
* docs: rewrite getting-started, fix ai-integration import paths
Getting started now covers all three abstractions:
- Service (write handlers, micro run, templates)
- Agent (micro.NewAgent, scoped tools, memory, CLI)
- Flow (event-driven LLM orchestration)
Leads with prompt-based generation, then manual service creation.
ai-integration.md: fixed flow import path from go-micro.dev/v5/ai/flow
to go-micro.dev/v5/flow, updated stack diagram to show agent/flow/chat.
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
* blog: Introducing micro.NewAgent()
Post 16 — announces Agent as a first-class abstraction. Shows the
API (NewAgent, AgentServices, AgentPrompt, AgentProvider), scoped
tools, persistent memory, multi-service agents, multi-agent systems,
and the three-abstraction comparison table (Service/Agent/Flow).
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
* feat: fix agent registration, blog post 16
Agent registration:
- Add node with address so mDNS can discover agents
- Store type and services in node metadata (mDNS requirement)
- Connect broker before subscribing, non-fatal if broker unavailable
- Print registration confirmation on Run()
Agent/chat discovery:
- Check both service-level and node-level metadata for type=agent
(mDNS stores metadata on nodes, not services)
Blog post 16: "Introducing micro.NewAgent()" — announces the Agent
abstraction with code examples, comparison table, multi-agent patterns.
Tested end-to-end: micro run → micro agent list discovers the agent →
micro chat routes to it → agent calls service endpoints.
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
* feat: agents are proper services with RPC Chat endpoint
Refactored agent to use server.Server instead of fake registry entries.
An agent now:
- Creates a real RPC server with server.Name(agentName)
- Registers an Agent.Chat handler callable via standard RPC
- Sets server metadata type=agent, services=x,y for discovery
- No more fake addresses or broker hacks
micro chat calls agents via RPC (client.Call) instead of creating
local agent instances. The registry stays clean — agents are real
services with real endpoints.
Removed broker dependency from agent options. Agent-to-agent
communication is just RPC like everything else.
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
* feat: agent uses proto-defined RPC interface
Added agent/proto/agent.proto with Agent service definition:
rpc Chat(ChatRequest) returns (ChatResponse)
Agent now implements the generated AgentHandler interface and
registers via pb.RegisterAgentHandler. The Chat endpoint is a
standard proto-based RPC callable by any go-micro client.
Renamed the programmatic API from Chat() to Ask() to avoid
collision with the proto handler method name.
micro chat calls agents via standard RPC with JSON-encoded
request/response — no special types needed on the caller side.
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
* feat: generate agent alongside services, update all docs
micro run --prompt now generates an agent binary that manages all
the generated services. The agent reads MICRO_AI_PROVIDER and
MICRO_AI_API_KEY from the environment. micro run propagates these
when started with --prompt.
Run banner shows services and agents separately.
Updated README, getting-started guide, and landing page to show
the complete flow: generate → services + agent start → micro chat
routes to agent → agent orchestrates services.
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd
---------
Co-authored-by: Claude <noreply@anthropic.com>