Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Unreleased: services and agents cleanup

- Removed the `flow` package, `micro.NewFlow` / `Flow*` helpers, flow CLI commands, and unused top-level Kubernetes deployment prototype.
- Agent checkpoints and recovery remain supported through `agent` and `agent/run`.

All notable changes to Go Micro are documented here.

Format follows [Keep a Changelog](https://keepachangelog.com/) and versions
Expand Down Expand Up @@ -80,7 +85,6 @@ below is kept current between tags and rolled into the next version when it ship
### Added
- **A2A inbound AP2 mandate verification (opt-in)** — set `Options.AP2PublicKey` (or `a2a.WithAP2PublicKey` for embedded handlers) and the gateway verifies AP2 payment/checkout mandates carried on incoming messages — signature and task/context binding — recording the outcome in each task's `ap2Verifications`, with the x402 settlement rail carried through for the paid path. Off by default. (`gateway/a2a/`)
- **Flow human-in-the-loop pause/resume** — a flow step can suspend a run for external input with `flow.Await(key, prompt)`: the run checkpoints with status `waiting`, `Flow.Waiting` lists suspended runs, and `Flow.ResumeWith(ctx, runID, input)` injects the input and continues. Recovery skips waiting runs since they need input, not a restart. (`flow/`)
- **Kubernetes reconcile core (alpha)** — `kubernetes.Reconcile(desired, observed)` decides the action needed to converge an `Agent`/`Service`/`Flow` resource toward its Deployment and returns `Ready`/`Error` conditions; dependency-free and unit-testable, on top of the embedded CRD foundation. (`deploy/kubernetes/`)
- **In-process "local network" fast-path (opt-in)** — `client.Local()` lets a unary `Call` to a co-located service skip the network transport and dispatch straight to the server's handlers (raw `codec/bytes.Frame` bodies — the shape agent/MCP/flow tool calls use). Benchmark: ~545µs → ~28µs (≈20×) with ~3.6× fewer allocations. `micro.Local()` turns it on service-wide. Off by default. (`client/`, `server/`, `service/`, `internal/network/`)
- **gRPC-reflection MCP** — the MCP gateway can expose reflected gRPC services as agent tools. (`gateway/mcp/`)
- **x402 buyer example and agent spend observability** — a runnable buyer-agent example, with x402 spend surfaced in run observability. (`examples/`, `agent/`, `wrapper/x402/`)
Expand Down
1 change: 0 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ go-micro/
├── config/ # Dynamic config (env, file, etcd, NATS)
├── errors/ # Error handling
├── events/ # Event system (NATS JetStream)
├── flow/ # Event-driven LLM orchestration
├── gateway/
│ ├── api/ # REST API gateway
│ └── mcp/ # MCP gateway (core AI integration)
Expand Down
3 changes: 1 addition & 2 deletions CODEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Go Micro is maintained by two AI tools — **Codex** (you) and **Claude Code** (

- Keep the 0→1 path current: scaffold, run, call, chat, inspect.
- Keep the 0→hero example current: a realistic multi-agent system that exercises
agents, services, flows, MCP, A2A, and observability.
agents, services, MCP, A2A, and observability.
- Add runnable examples for new primitives before adding broad prose.

### 5. Hardening backlog
Expand Down Expand Up @@ -122,7 +122,6 @@ make test
make harness
make lint
go run ./examples/hello-world
go run ./internal/harness/universe
```

### Week 2: choose one roadmap slice
Expand Down
23 changes: 3 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LDFLAGS = -X $(GIT_IMPORT).version=$(GIT_TAG)
# GORELEASER_DOCKER_IMAGE = ghcr.io/goreleaser/goreleaser-cross:v1.25.7
GORELEASER_DOCKER_IMAGE = ghcr.io/goreleaser/goreleaser:latest

.PHONY: service-smoke chat-smoke test test-race test-coverage harness composition-gate recovery-gate zero-to-hero-transcript inner-loop cli-wayfinding docs-wayfinding install-smoke provider-conformance-mock provider-conformance lint fmt install-tools proto clean help gorelease-dry-run gorelease-dry-run-docker
.PHONY: service-smoke chat-smoke test test-race test-coverage harness zero-to-hero-transcript inner-loop cli-wayfinding docs-wayfinding install-smoke provider-conformance-mock provider-conformance lint fmt install-tools proto clean help gorelease-dry-run gorelease-dry-run-docker

# Default target
help:
Expand All @@ -17,8 +17,6 @@ help:
@echo " make test-coverage - Run tests with coverage"
@echo " make lint - Run linter"
@echo " make harness - Run deterministic getting-started and end-to-end harnesses"
@echo " make composition-gate - Run restartable service-agent-flow acceptance fixture"
@echo " make recovery-gate - Run restart and failure-injection acceptance fixture"
@echo " make chat-smoke - Exercise chat setup, tools, approvals, and recovery in a terminal"
@echo " make zero-to-hero-transcript - Verify the ordered 0→hero lifecycle transcript"
@echo " make inner-loop - Verify scaffold → run/chat/inspect → deploy dry-run contract"
Expand Down Expand Up @@ -50,32 +48,17 @@ test-coverage:
@echo "Coverage report: coverage.html"

# Run the documented getting-started contracts plus the deterministic
# services → agents → workflows harnesses (mock LLM — no API key).
# services → agents harnesses (mock LLM — no API key).
# This mirrors the default CI path so local dogfooding catches scaffold,
# run/chat/inspect, and 0→hero regressions before a PR is opened.
harness:
$(MAKE) cli-wayfinding
$(MAKE) inner-loop
$(MAKE) zero-to-hero-transcript
go run ./internal/harness/agent-flow
$(MAKE) composition-gate
$(MAKE) recovery-gate
$(MAKE) provider-conformance-mock

# Provider-free complete-composition contract: real RPC, bounded agent tool
# work, durable approval, replacement flow hosts, and an idempotent final effect.
composition-gate:
go run -race ./internal/harness/composition

# Provider-free v7 recovery contract: replace a flow host while retaining its
# checkpoint, preserve waiting work and lineage, inject an ambiguous effect and
# concurrent duplicate resumes, enforce idempotent effects, and record exhausted
# retry budgets as failures.
recovery-gate:
go run ./internal/harness/recovery

# Verify the maintained 0→hero transcript in the same order documented for new
# developers: scaffold → run/chat/inspect → support-agent chat → flow history →
# developers: scaffold → run/chat/inspect → support-agent chat →
# deploy dry-run. This is the focused CI contract for the full lifecycle path.
zero-to-hero-transcript:
./internal/harness/zero-to-hero-ci/run.sh
Expand Down
9 changes: 4 additions & 5 deletions agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"testing"

pb "go-micro.dev/v6/agent/proto"
"go-micro.dev/v6/flow"
"go-micro.dev/v6/metadata"
"go-micro.dev/v6/model"
"go-micro.dev/v6/store"
Expand Down Expand Up @@ -155,12 +154,12 @@ func TestChatPreservesTransportedFlowLineageThroughToolExecution(t *testing.T) {
}

func TestResumeRestoresPersistedFlowLineage(t *testing.T) {
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "ops-agent")
run := flow.Run{
cp := StoreCheckpoint(store.NewMemoryStore(), "ops-agent")
run := Run{
ID: "agent-run-resume", ParentID: "flow-run-resume", Flow: "ops-agent",
OriginFlow: "daily-ops", OriginStep: "summarize", Dispatch: "schedule", Trigger: "daily-review",
State: flow.State{Stage: "ask", Data: []byte("resume review")},
Steps: []flow.StepRecord{{Name: "ask", Status: "failed"}}, Status: "failed",
State: State{Stage: "ask", Data: []byte("resume review")},
Steps: []StepRecord{{Name: "ask", Status: "failed"}}, Status: "failed",
}
if err := cp.Save(context.Background(), run); err != nil {
t.Fatal(err)
Expand Down
11 changes: 5 additions & 6 deletions agent/approval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"strings"
"testing"

"go-micro.dev/v6/flow"
"go-micro.dev/v6/model"
"go-micro.dev/v6/store"
)
Expand All @@ -21,7 +20,7 @@ func TestDurableApprovalExecutesSavedCallAfterRestart(t *testing.T) {
}
t.Run(name, func(t *testing.T) {
st := store.NewMemoryStore()
cp := flow.StoreCheckpoint(st, "approval")
cp := StoreCheckpoint(st, "approval")
toolCalls, modelCalls, approvalCalls := 0, 0, 0
ctx := context.WithValue(context.Background(), approvalIdentityKey{}, "reviewer")
makeAgent := func() *agentImpl {
Expand Down Expand Up @@ -122,19 +121,19 @@ func TestDurableApprovalExecutesSavedCallAfterRestart(t *testing.T) {
}

type failingApprovalCheckpoint struct {
flow.Checkpoint
Checkpoint
saves int
}

func (cp *failingApprovalCheckpoint) Save(ctx context.Context, run flow.Run) error {
func (cp *failingApprovalCheckpoint) Save(ctx context.Context, run Run) error {
cp.saves++
if cp.saves == 2 {
return errors.New("approval storage unavailable")
}
return cp.Checkpoint.Save(ctx, run)
}
func TestDurableApprovalFailsClosedOnSaveError(t *testing.T) {
cp := &failingApprovalCheckpoint{Checkpoint: flow.StoreCheckpoint(store.NewMemoryStore(), "failed-approval")}
cp := &failingApprovalCheckpoint{Checkpoint: StoreCheckpoint(store.NewMemoryStore(), "failed-approval")}
executed := 0
a := newTestAgent(Name("save-failure"), WithCheckpoint(cp), WithApproval(func(context.Context, model.ToolCall) (ApprovalDecision, error) {
return ApprovalDecision{Status: ApprovalPending, ID: "review"}, nil
Expand All @@ -154,7 +153,7 @@ func TestDurableApprovalFailsClosedOnSaveError(t *testing.T) {
}

func TestDurableApprovalReturnsPauseAfterProviderCancellation(t *testing.T) {
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "canceled-approval")
cp := StoreCheckpoint(store.NewMemoryStore(), "canceled-approval")
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
a := newTestAgent(Name("cancel-after-save"), WithCheckpoint(cp), WithApproval(func(context.Context, model.ToolCall) (ApprovalDecision, error) {
Expand Down
55 changes: 27 additions & 28 deletions agent/checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import (

"go-micro.dev/v6/client"
codecBytes "go-micro.dev/v6/codec/bytes"
"go-micro.dev/v6/flow"
"go-micro.dev/v6/model"
"go-micro.dev/v6/registry"
"go-micro.dev/v6/store"
)

func TestResumeCompletedCheckpointDoesNotReplayModel(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "durable-agent")
cp := StoreCheckpoint(store.NewMemoryStore(), "durable-agent")
calls := 0
fakeGen = func(ctx context.Context, opts model.Options, req *model.Request) (*model.Response, error) {
calls++
Expand Down Expand Up @@ -59,7 +58,7 @@ func TestResumeCompletedCheckpointDoesNotReplayModel(t *testing.T) {

func TestResumeFailedCheckpointDoesNotReplayCompletedTool(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "tool-resume-agent")
cp := StoreCheckpoint(store.NewMemoryStore(), "tool-resume-agent")
toolRuns := 0
first := true
fakeGen = func(ctx context.Context, opts model.Options, req *model.Request) (*model.Response, error) {
Expand Down Expand Up @@ -117,7 +116,7 @@ func TestResumeFailedCheckpointDoesNotReplayCompletedTool(t *testing.T) {

func TestCheckpointSkipsDuplicateToolWithinAsk(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "tool-dedupe-agent")
cp := StoreCheckpoint(store.NewMemoryStore(), "tool-dedupe-agent")
toolRuns := 0
fakeGen = func(ctx context.Context, opts model.Options, req *model.Request) (*model.Response, error) {
if opts.ToolHandler == nil {
Expand Down Expand Up @@ -156,12 +155,12 @@ func TestCheckpointSkipsDuplicateToolWithinAsk(t *testing.T) {

func TestCheckpointToolWrapSurvivesClearedCurrentRun(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "tool-cleared-run-agent")
run := flow.Run{
cp := StoreCheckpoint(store.NewMemoryStore(), "tool-cleared-run-agent")
run := Run{
ID: "run-1",
Flow: "tool-cleared-run-agent",
Status: "running",
Steps: []flow.StepRecord{{Name: agentAskStep, Status: "in_progress"}},
Steps: []StepRecord{{Name: agentAskStep, Status: "in_progress"}},
}
a := &agentImpl{
opts: newOptions(Name("tool-cleared-run-agent"), WithCheckpoint(cp)),
Expand Down Expand Up @@ -195,7 +194,7 @@ func TestCheckpointToolWrapSurvivesClearedCurrentRun(t *testing.T) {

func TestCheckpointContinuesRunWithUnfinishedPlanStep(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "unfinished-plan-agent")
cp := StoreCheckpoint(store.NewMemoryStore(), "unfinished-plan-agent")

reg := registry.NewMemoryRegistry()
if err := reg.Register(&registry.Service{
Expand Down Expand Up @@ -270,7 +269,7 @@ func TestCheckpointContinuesRunWithUnfinishedPlanStep(t *testing.T) {

func TestCheckpointContinuesRunThroughSeveralSingleStepTurns(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "single-step-plan-agent")
cp := StoreCheckpoint(store.NewMemoryStore(), "single-step-plan-agent")

completed := []string{}
modelCalls := 0
Expand Down Expand Up @@ -337,7 +336,7 @@ func TestCheckpointContinuesRunThroughSeveralSingleStepTurns(t *testing.T) {
func TestResumeFailedCheckpointAfterFreshAgentRestart(t *testing.T) {
ctx := context.Background()
st := store.NewMemoryStore()
cp := flow.StoreCheckpoint(st, "restart-resume-agent")
cp := StoreCheckpoint(st, "restart-resume-agent")
toolRuns := 0
modelCalls := 0
failFirst := true
Expand Down Expand Up @@ -448,7 +447,7 @@ func TestResumeFailedCheckpointAfterFreshAgentRestart(t *testing.T) {
func TestResumePendingAfterFreshAgentRestartDoesNotReplayCompletedTool(t *testing.T) {
ctx := context.Background()
st := store.NewMemoryStore()
cp := flow.StoreCheckpoint(st, "startup-resume-agent")
cp := StoreCheckpoint(st, "startup-resume-agent")
toolRuns := 0
failFirst := true
fakeGen = func(ctx context.Context, opts model.Options, req *model.Request) (*model.Response, error) {
Expand Down Expand Up @@ -513,7 +512,7 @@ func TestResumePendingAfterFreshAgentRestartDoesNotReplayCompletedTool(t *testin
func TestResumeFailedCheckpointDoesNotDuplicateCompactedMemory(t *testing.T) {
ctx := context.Background()
st := store.NewMemoryStore()
cp := flow.StoreCheckpoint(st, "memory-resume-agent")
cp := StoreCheckpoint(st, "memory-resume-agent")
failRetry := true
var sawRecall bool
fakeGen = func(ctx context.Context, opts model.Options, req *model.Request) (*model.Response, error) {
Expand Down Expand Up @@ -578,12 +577,12 @@ func countMemoryContent(messages []model.Message, needle string) int {

func TestResumePendingResumesOldestAgentRunsUntilFailure(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "resume-pending-agent")
cp := StoreCheckpoint(store.NewMemoryStore(), "resume-pending-agent")
base := time.Date(2026, 7, 7, 12, 0, 0, 0, time.UTC)
for _, run := range []flow.Run{
{ID: "run-ok", Flow: "resume-pending-agent", Status: "failed", State: flow.State{Stage: agentAskStep, Data: []byte("ok")}, Started: base},
{ID: "run-blocked", Flow: "resume-pending-agent", Status: "failed", State: flow.State{Stage: agentAskStep, Data: []byte("block")}, Started: base.Add(time.Minute)},
{ID: "run-later", Flow: "resume-pending-agent", Status: "failed", State: flow.State{Stage: agentAskStep, Data: []byte("later")}, Started: base.Add(2 * time.Minute)},
for _, run := range []Run{
{ID: "run-ok", Flow: "resume-pending-agent", Status: "failed", State: State{Stage: agentAskStep, Data: []byte("ok")}, Started: base},
{ID: "run-blocked", Flow: "resume-pending-agent", Status: "failed", State: State{Stage: agentAskStep, Data: []byte("block")}, Started: base.Add(time.Minute)},
{ID: "run-later", Flow: "resume-pending-agent", Status: "failed", State: State{Stage: agentAskStep, Data: []byte("later")}, Started: base.Add(2 * time.Minute)},
} {
if err := cp.Save(ctx, run); err != nil {
t.Fatalf("Save(%s): %v", run.ID, err)
Expand Down Expand Up @@ -623,8 +622,8 @@ func TestResumePendingResumesOldestAgentRunsUntilFailure(t *testing.T) {

func TestPendingReturnsUnfinishedAgentRuns(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "pending-agent")
run := flow.Run{ID: "run-1", Flow: "pending-agent", Status: "failed", State: flow.State{Stage: agentAskStep, Data: []byte("retry me")}}
cp := StoreCheckpoint(store.NewMemoryStore(), "pending-agent")
run := Run{ID: "run-1", Flow: "pending-agent", Status: "failed", State: State{Stage: agentAskStep, Data: []byte("retry me")}}
if err := cp.Save(ctx, run); err != nil {
t.Fatalf("Save: %v", err)
}
Expand All @@ -640,12 +639,12 @@ func TestPendingReturnsUnfinishedAgentRuns(t *testing.T) {

func TestPendingSkipsTerminalCanceledAndExpiredAgentRuns(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "terminal-agent")
for _, run := range []flow.Run{
{ID: "active", Flow: "terminal-agent", Status: "failed", State: flow.State{Stage: agentAskStep, Data: []byte("retry me")}},
{ID: "done", Flow: "terminal-agent", Status: "done", State: flow.State{Stage: agentAskStep, Data: []byte("done")}},
{ID: "canceled", Flow: "terminal-agent", Status: "canceled", State: flow.State{Stage: agentAskStep, Data: []byte("canceled")}},
{ID: "expired", Flow: "terminal-agent", Status: "expired", State: flow.State{Stage: agentAskStep, Data: []byte("expired")}},
cp := StoreCheckpoint(store.NewMemoryStore(), "terminal-agent")
for _, run := range []Run{
{ID: "active", Flow: "terminal-agent", Status: "failed", State: State{Stage: agentAskStep, Data: []byte("retry me")}},
{ID: "done", Flow: "terminal-agent", Status: "done", State: State{Stage: agentAskStep, Data: []byte("done")}},
{ID: "canceled", Flow: "terminal-agent", Status: "canceled", State: State{Stage: agentAskStep, Data: []byte("canceled")}},
{ID: "expired", Flow: "terminal-agent", Status: "expired", State: State{Stage: agentAskStep, Data: []byte("expired")}},
} {
if err := cp.Save(ctx, run); err != nil {
t.Fatalf("Save(%s): %v", run.ID, err)
Expand All @@ -669,7 +668,7 @@ func TestPendingSkipsTerminalCanceledAndExpiredAgentRuns(t *testing.T) {

func TestHumanInputPauseResumesSameRunWithInput(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "input-agent")
cp := StoreCheckpoint(store.NewMemoryStore(), "input-agent")
calls := 0
fakeGen = func(ctx context.Context, opts model.Options, req *model.Request) (*model.Response, error) {
calls++
Expand Down Expand Up @@ -727,7 +726,7 @@ func TestHumanInputPauseResumesSameRunWithInput(t *testing.T) {

func TestHumanInputResumeHonorsCanceledContextAndLeavesRunPending(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "input-cancel-agent")
cp := StoreCheckpoint(store.NewMemoryStore(), "input-cancel-agent")
fakeGen = func(ctx context.Context, opts model.Options, req *model.Request) (*model.Response, error) {
if opts.ToolHandler != nil {
opts.ToolHandler(ctx, model.ToolCall{ID: "input-1", Name: toolHumanInput, Input: map[string]any{"prompt": "Approve deploy?"}})
Expand Down Expand Up @@ -772,7 +771,7 @@ func TestHumanInputResumeHonorsCanceledContextAndLeavesRunPending(t *testing.T)

func TestApprovalDenialPausesCheckpointedRunAndResumeContinues(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "approval-agent")
cp := StoreCheckpoint(store.NewMemoryStore(), "approval-agent")
calls := 0
fakeGen = func(ctx context.Context, opts model.Options, req *model.Request) (*model.Response, error) {
calls++
Expand Down
3 changes: 1 addition & 2 deletions agent/otel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"testing"
"time"

"go-micro.dev/v6/flow"
"go-micro.dev/v6/model"
"go-micro.dev/v6/store"
"go.opentelemetry.io/otel/attribute"
Expand Down Expand Up @@ -648,7 +647,7 @@ func TestAgentCheckpointAndResumeTimelineEvents(t *testing.T) {
exp := tracetest.NewInMemoryExporter()
tp := trace.NewTracerProvider(trace.WithSyncer(exp))
st := store.NewMemoryStore()
cp := flow.StoreCheckpoint(st, "resume-otel-agent")
cp := StoreCheckpoint(st, "resume-otel-agent")
first := true
fakeGen = func(ctx context.Context, opts model.Options, req *model.Request) (*model.Response, error) {
if first {
Expand Down
Loading
Loading