micro--go-micro
9fdcc24cce
* 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>
60 行
2.1 KiB
YAML
60 行
2.1 KiB
YAML
name: Universe (E2E)
|
|
|
|
# Spins up a mini go-micro world end-to-end — services, a durable flow
|
|
# that crashes and resumes, and an agent — then shuts it down. Everything
|
|
# is real except the LLM, which is mocked, so the default job is
|
|
# deterministic and needs no secrets. A second job runs the same scenario
|
|
# against a live model when an API key secret is configured.
|
|
|
|
on:
|
|
push:
|
|
branches: ["**"]
|
|
pull_request:
|
|
branches: ["**"]
|
|
schedule:
|
|
- cron: "17 6 * * *" # daily, so the world is exercised even without changes
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
universe:
|
|
name: Mini universe (mock LLM)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: stable
|
|
cache: true
|
|
- name: Build
|
|
run: go build ./...
|
|
- name: Universe end-to-end (asserts; exits non-zero on failure)
|
|
run: go run ./internal/harness/universe
|
|
- name: Agent-flow harness
|
|
run: go run ./internal/harness/agent-flow
|
|
- name: Plan-delegate harness
|
|
run: go run ./internal/harness/plan-delegate
|
|
|
|
universe-live:
|
|
name: Mini universe (live LLM, if key present)
|
|
runs-on: ubuntu-latest
|
|
# Only on the daily schedule or a manual run — never automatically on
|
|
# every push/PR, so changes don't quietly burn API credits. Trigger it
|
|
# by hand (Actions → Universe → Run workflow) when changing the agent,
|
|
# flow, or AI internals and you want a real-model check.
|
|
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: stable
|
|
cache: true
|
|
- name: Universe against a live model (AtlasCloud)
|
|
env:
|
|
ATLASCLOUD_API_KEY: ${{ secrets.ATLASCLOUD_API_KEY }}
|
|
run: |
|
|
if [ -z "$ATLASCLOUD_API_KEY" ]; then
|
|
echo "No ATLASCLOUD_API_KEY secret configured — skipping the live run."
|
|
exit 0
|
|
fi
|
|
go run ./internal/harness/universe -provider atlascloud
|