hydaelyn

package module
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 9 Imported by: 0

README

Hydaelyn

Go Reference CI Release

Hydaelyn is a Go library for multi-agent workloads that need crash recovery, human approvals, and idempotent side effects. Its Runner records typed Run, Task, Event, Lease, Approval, and ActionAttempt state through configurable stores. Applications embed the runner and provide the production storage implementation.

Status: The latest release is v0.11.0. The public API may still change before v1.0.

Why Hydaelyn

Agent workloads must preserve state across crashes, prevent duplicate side effects, and record decisions that cross process or human boundaries. Hydaelyn handles those concerns in four concrete ways:

  • Recovery: commands are persisted, leased, audited, and resumable; guarded side effects use an action-attempt ledger.
  • Type safety: CI rejects exported []any results and loose any fields in the public API.
  • Storage ownership: applications implement the storage contract; the kernel ships no production backend or domain schema.
  • Embedding: Hydaelyn runs as a library in a normal Go program. It ships no UI or hosted service.

At a glance

  • Strong bounded agent loop (agent/): one agent does one task well: step trace, schema repair, tool safety, context management, typed failure, and budget enforcement. Reusable skill/ instruction bundles support explicit and model-driven activation there; they do not grant host tools or create a second runtime.
  • Explicit multi-agent scheduler (multiagent/): first-class AgentClass, Team, Scheduler, Dispatch, typed Handoff, Blackboard, Voting, and Supervisor, instead of ad-hoc helpers.
  • Durable runner (root + internal/): runs, tasks, events, leases, approvals, an outbox / action-attempt ledger for idempotent side effects, and handoffs, all persisted and replayable.
  • Workflow modeling (workflow/): a declarative Definition compiles to a multiagent graph; it adds no second runtime.
  • Durable triggers (transport/cron, transport/webhook, and others): schedule and event entry points, with per-trigger timezone support on the cron driver.
  • Product packs (packs/): vertical skeletons free to encode domain vocabulary the kernel never touches.

Install

go get github.com/Viking602/go-hydaelyn@latest

Requires Go 1.25+. Repository development and release gates pin Go 1.25.12.

Agent Skills

Hydaelyn supports the complete local Agent Skills lifecycle: trusted directory discovery, standards-compatible SKILL.md parsing, explicit activation, metadata-only catalog disclosure, model-driven activation, and bounded on-demand reads from scripts/, references/, and assets/.

found, err := skill.Discover(skill.DiscoveryOptions{
	ProjectDir:   projectRoot,
	TrustProject: true,
})
if err != nil {
	return err
}
skills := skill.NewRegistry()
for _, current := range found.Skills {
	if err := skill.Register(skills, current); err != nil {
		return err
	}
}
engine, err := agent.Build(agent.Spec{
	Model:           "gpt-5",
	Skills:          []string{"always-on-review"},
	AvailableSkills: []string{"pdf-processing"},
}, agent.BuildDeps{Providers: providers, Skills: skills})

Skills are injected immediately. AvailableSkills disclose only names and descriptions until the model calls the framework-owned activation tool. Project skills are ignored unless TrustProject is true; additional discovery roots are explicit trust grants. Bundled files are listed without being loaded, and reads are limited to the captured manifest. Skills never grant host tools and scripts are never executed automatically: allowed-tools remains advisory while Spec.Tools, the tool bus, hooks, and policy remain authoritative.

Run the complete local example with go run ./_examples/skills.

Quickstart

Queue a run on the default in-memory runner and read the append-only event stream:

package main

import (
	"context"
	"fmt"

	"github.com/Viking602/go-hydaelyn"
	"github.com/Viking602/go-hydaelyn/api"
)

func main() {
	runner := hydaelyn.NewDevelopment()

	run, err := runner.QueueRun(context.Background(), api.StartRunCommand{
		Request: "compare options for a Go research assistant",
	})
	if err != nil {
		panic(err)
	}

	events, err := runner.RunEvents(context.Background(), run.ID)
	if err != nil {
		panic(err)
	}
	fmt.Println(run.ID, len(events))
}

Override defaults via api.Config:

runner := hydaelyn.NewDevelopment(api.Config{
	PolicyEngine: policy.DenySideEffectsByDefault(),
})

Continue with the full quickstart, or run the workflow example for a declarative multi-step flow.

How it works

Hydaelyn is four layers. Their critical import seams are explicit and checked in CI: api/ imports no Hydaelyn package, agent/ never imports multiagent/, multiagent/ never imports the root Runner, worker/, or internal/, and the root facade never imports multiagent/. The shared stream/ package is intentionally available to multiagent/; it is a runtime-neutral collaboration primitive, not an upward dependency on Runner.

┌─────────────────────────────────────────────┐
│ Packs / Workflow / Examples                 │
│ research, customer-support, devops, aiops,  │
│ workflow modeling                           │
└─────────────────────────────────────────────┘
                    ↓
┌─────────────────────────────────────────────┐
│ Multi-Agent Layer  (multiagent/)            │
│ AgentClass, AgentInstance, Team, Scheduler, │
│ Dispatch, typed Handoff, Blackboard, Voting │
└─────────────────────────────────────────────┘
                    ↓
┌─────────────────────────────────────────────┐
│ Agent Loop Layer  (agent/)                  │
│ Step, OutputPolicy, ToolSafety,             │
│ ContextManager, AgentFailure, LoopPolicy    │
└─────────────────────────────────────────────┘
                    ↓
┌─────────────────────────────────────────────┐
│ Durable Runner  (root + internal/)          │
│ Run / Task / Event / Lease / Approval /     │
│ Outbox / ActionAttempt / Handoff stores     │
└─────────────────────────────────────────────┘

The durable runner is what makes the upper layers safe to operate. The root Runner façade exposes typed commands for the full lifecycle: QueueRun / RunEvents, task leasing (AcquireTaskExecution), human approvals (RequestApproval / DecideApproval with resume tokens), idempotent side effects (StartActionAttempt / CompleteActionAttempt), trace spans, the blackboard, and the task-envelope mailbox. Storage sits behind a contract (ADR-012); the default runner keeps everything in memory so you can start without provisioning anything, and you swap in your own backend for production by implementing the store interfaces.

Workflow layer

workflow/ is a modeling layer, not a runtime. A workflow.Definition (built fluently with New().Step().Then().Branch().Map()) compiles to a multiagent.CompiledGraph:

Definition ──Compile──▶ Compiled ──Scheduler()──▶ multiagent.Scheduler
                                └──Graph()──────▶ multiagent.CompiledGraph

Because it lowers to the existing graph, workflow execution still flows through multiagent.Scheduler decisions and multiagent.Dispatch values. It does not create a second durable runtime and does not bypass Runner-owned Run, Task, Event, Lease, Policy, or Outbox behavior. Engine is an in-process convenience over multiagent.Drive; for durable execution, supply a multiagent.Executor that persists each dispatch through the root Runner before running agent work.

Two constraints worth knowing:

  • Branch conditions must be pure functions of api.TypedReport. The compiled graph may evaluate them during replay or recovery, so they must not read clocks, mutate state, call providers, or depend on process-local counters.
  • flow / api.Flow (preset adapter metadata) is a separate concept from workflow/, despite sharing the same English word.

Examples

Examples live under _examples/ (the leading underscore keeps them out of go build ./...). Run one with go run ./_examples/<name>.

  • incident_response: fan-out, blackboard, review, approval, and action in one flow.
  • workflow: a declarative workflow compiled to a multi-agent graph.
  • subagent: agent-as-tool delegation across models and providers.
  • evaluation: the evaluation harness.

Browse the _examples directory for the complete set.

Documentation

Scope & status

By design the kernel ships no:

  • Built-in storage backend
  • Built-in memory backend
  • Domain vocabulary
  • UI / console
  • Hosted observability backends
  • Provider-specific deep integrations

These belong in application code or optional plugins.

Development

See CONTRIBUTING.md for coding standards and the architectural gates CI enforces (sentrux, check-public-any.sh, check-business-words.sh, check-import-boundaries.sh). The fast local gate is make verify; run make ci-local before substantial changes.

Documentation

Overview

Package hydaelyn is the root facade for the go-hydaelyn runner. It owns construction and the Runner wrapper:

runner := hydaelyn.NewDevelopment()

Import api for public contracts such as Config, commands, store interfaces, policy requests, and Run/Task value types.

Public packages are grouped by stable extension concern:

  • hydaelyn — Runner construction, methods, and error re-exports
  • api — Config, commands, interfaces, Run/Task data contracts
  • [agent] — agent engine and profile contracts
  • [tool] — tool contract, effect types, and tooltest helpers
  • [flow] — flow preset contracts
  • [policy] — unified authorization contract
  • [blackboard] — blackboard item and selector contracts
  • [provider] — LLM provider drivers (anthropic, openai, scripted)
  • [message] — shared message/content data types
  • [hook] — pre/post-turn hook contracts
  • [transport] — integration transports such as MCP
  • [worker] — optional Runner-to-agent.Engine execution glue

Types under internal/ are implementation details. Core storage, mailbox, transition, command-handler, and replay internals are not public extension points and cannot be imported by consumers.

Package hydaelyn is the public façade for the Hydaelyn runner.

Import github.com/Viking602/go-hydaelyn/api for public contracts such as Config, commands, interfaces, and value types. The root package owns only construction, Runner methods, and sentinel error re-exports.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound                = api.ErrNotFound
	ErrTerminalState           = api.ErrTerminalState
	ErrStaleTaskVersion        = api.ErrStaleTaskVersion
	ErrLeaseHolderMismatch     = api.ErrLeaseHolderMismatch
	ErrLeaseNotActive          = api.ErrLeaseNotActive
	ErrOwnerMismatch           = api.ErrOwnerMismatch
	ErrActionTaskRequired      = api.ErrActionTaskRequired
	ErrActionReconcileRequired = api.ErrActionReconcileRequired
	ErrIdempotencyConflict     = api.ErrIdempotencyConflict
	ErrResponseTaskRequired    = api.ErrResponseTaskRequired
	ErrPolicyDenied            = api.ErrPolicyDenied
	ErrPolicyObligationFailed  = api.ErrPolicyObligationFailed
	ErrHandoffCycle            = api.ErrHandoffCycle
	ErrHandoffDepthExceeded    = api.ErrHandoffDepthExceeded
	ErrInvalidCommand          = api.ErrInvalidCommand
	ErrInvalidTransition       = api.ErrInvalidTransition
	ErrCompletionCriteriaUnmet = api.ErrCompletionCriteriaUnmet
	ErrDependencyUnmet         = api.ErrDependencyUnmet
	ErrDependencyFailed        = api.ErrDependencyFailed
	ErrInvalidConfiguration    = api.ErrInvalidConfiguration
	ErrInvalidAddress          = api.ErrInvalidAddress
	ErrNoRecipients            = api.ErrNoRecipients
	ErrSubscriptionClosed      = api.ErrSubscriptionClosed
	ErrWaitTimeout             = api.ErrWaitTimeout
)

Public sentinel errors are owned by api and re-exported here for callers that only need root-level construction and error checks.

Functions

func DefaultConfig added in v0.7.0

func DefaultConfig() api.Config

DefaultConfig returns an empty api.Config; useful as a baseline before overriding individual fields.

Types

type Runner added in v0.7.0

type Runner struct {
	// contains filtered or unexported fields
}

Runner is the public façade over the internal runtime. All public contract values crossing this boundary use api package types, not internal/core types.

func New deprecated

func New(configs ...api.Config) *Runner

New constructs an in-memory development runner.

Deprecated: use NewDevelopment for local/test use or NewProduction for a runner that rejects missing durable storage and policy dependencies.

func NewDevelopment added in v0.10.0

func NewDevelopment(configs ...api.Config) *Runner

NewDevelopment constructs a runner with in-memory storage and allow-all policy defaults. It is intended for tests, examples, and local development.

func NewProduction added in v0.10.0

func NewProduction(cfg api.Config) (*Runner, error)

NewProduction constructs a runner only when the host supplies both durable storage and an explicit policy. The framework cannot verify whether a StoreProvider is durable, so production ownership remains with the host.

func (*Runner) AckEnvelope added in v0.7.0

func (r *Runner) AckEnvelope(ctx context.Context, cmd api.AckEnvelopeCommand) error

func (*Runner) AcquireTaskExecution added in v0.7.0

func (r *Runner) AcquireTaskExecution(ctx context.Context, cmd api.AcquireTaskExecutionCommand) (api.TaskExecutionLease, bool, error)

func (*Runner) ActiveLeaseCount deprecated added in v0.7.0

func (r *Runner) ActiveLeaseCount(runID, taskID string) int

Deprecated: use ActiveLeaseCountContext.

func (*Runner) ActiveLeaseCountContext added in v0.10.0

func (r *Runner) ActiveLeaseCountContext(ctx context.Context, runID, taskID string) int

func (*Runner) AdvanceRun added in v0.7.0

func (r *Runner) AdvanceRun(ctx context.Context, cmd api.AdvanceRunCommand) (api.Run, error)

func (*Runner) Agents added in v0.7.0

func (r *Runner) Agents() []api.AgentProfile

func (*Runner) AppendEvent added in v0.7.0

func (r *Runner) AppendEvent(ctx context.Context, event api.Event) error

func (*Runner) AppendUsage added in v0.9.0

func (r *Runner) AppendUsage(ctx context.Context, record api.UsageRecord) error

AppendUsage persists one usage-metering record. The worker runtime calls it after every engine run; hosts may also append their own records (e.g. for non-engine model calls).

func (*Runner) Begin added in v0.7.0

func (r *Runner) Begin(ctx context.Context) (api.UnitOfWork, error)

func (*Runner) Close added in v0.10.0

func (r *Runner) Close(ctx context.Context) error

func (*Runner) CompleteActionAttempt added in v0.7.0

func (r *Runner) CompleteActionAttempt(ctx context.Context, cmd api.CompleteActionAttemptCommand) (api.ActionAttempt, error)

func (*Runner) CreateTask added in v0.7.0

func (r *Runner) CreateTask(ctx context.Context, cmd api.CreateTaskCommand) (api.Task, error)

func (*Runner) DeadLetter added in v0.7.0

func (r *Runner) DeadLetter(ctx context.Context, cmd api.DeadLetterCommand) error

func (*Runner) DecideApproval added in v0.7.0

func (r *Runner) DecideApproval(ctx context.Context, cmd api.DecideApprovalCommand) error

func (*Runner) DispatchTask added in v0.7.0

func (r *Runner) DispatchTask(ctx context.Context, cmd api.DispatchTaskCommand) (api.TaskEnvelope, error)

func (*Runner) DispatchTaskFanOut added in v0.7.0

func (r *Runner) DispatchTaskFanOut(ctx context.Context, cmd api.FanOutDispatchTaskCommand) ([]api.TaskEnvelope, error)

func (*Runner) DrainResponseOutbox added in v0.7.0

func (r *Runner) DrainResponseOutbox(ctx context.Context) (int, error)

func (*Runner) EndTraceSpan added in v0.7.0

func (r *Runner) EndTraceSpan(ctx context.Context, cmd api.EndTraceSpanCommand) error

func (*Runner) Events deprecated added in v0.7.0

func (r *Runner) Events(runID string) []api.Event

Deprecated: use RunEvents so cancellation and storage errors are observable.

func (*Runner) ExecuteCommand deprecated added in v0.7.0

func (r *Runner) ExecuteCommand(ctx context.Context, command api.Command) (any, error)

ExecuteCommand dispatches a Command through the internal command bus and returns the typed result. For most use cases prefer the typed methods (QueueRun, StartRun, RequestApproval, AcquireTaskExecution, ...) which avoid the result-type assertion and provide better compile-time signatures. ExecuteCommand exists for tools (replay, migration, admin) that operate generically over Commands.

Result types follow the api.<Command>Result naming convention where a command produces a structured value (StartRunCommand -> api.StartRunResult, RequestApprovalCommand -> api.RequestApprovalResult, AcquireTaskExecutionCommand -> api.AcquireTaskExecutionResult). Commands that produce a single domain value return that value directly.

Deprecated: use the typed Runner methods so result shapes are checked at compile time.

func (*Runner) HeartbeatTaskExecution added in v0.7.0

func (r *Runner) HeartbeatTaskExecution(ctx context.Context, cmd api.HeartbeatTaskExecutionCommand) error

func (*Runner) InvokeTool added in v0.7.0

func (*Runner) ListEnvelopes added in v0.7.0

func (r *Runner) ListEnvelopes(ctx context.Context, runID string) ([]api.TaskEnvelope, error)

func (*Runner) ListEvents added in v0.7.0

func (r *Runner) ListEvents(ctx context.Context, runID string) ([]api.Event, error)

func (*Runner) ListMessages added in v0.7.0

func (r *Runner) ListMessages(ctx context.Context, runID string) ([]api.UserMessage, error)

func (*Runner) ListQueuedMessages added in v0.7.0

func (r *Runner) ListQueuedMessages(ctx context.Context) ([]api.UserMessage, error)

func (*Runner) ListTasks added in v0.7.0

func (r *Runner) ListTasks(ctx context.Context, runID string) ([]api.Task, error)

func (*Runner) ListTraceSpans added in v0.7.0

func (r *Runner) ListTraceSpans(ctx context.Context, runID string) ([]api.TraceSpan, error)

func (*Runner) LoadEnvelope added in v0.7.0

func (r *Runner) LoadEnvelope(ctx context.Context, envelopeID string) (api.TaskEnvelope, error)

func (*Runner) LoadMessage added in v0.7.0

func (r *Runner) LoadMessage(ctx context.Context, runID, messageID string) (api.UserMessage, error)

func (*Runner) LoadRun added in v0.7.0

func (r *Runner) LoadRun(ctx context.Context, runID string) (api.Run, error)

func (*Runner) LoadTask added in v0.7.0

func (r *Runner) LoadTask(ctx context.Context, runID, taskID string) (api.Task, error)

func (*Runner) Mode added in v0.10.0

func (r *Runner) Mode() api.RuntimeMode

Mode reports whether the runner was created with development defaults or validated production dependencies.

func (*Runner) PendingResumeTokens added in v0.9.0

func (r *Runner) PendingResumeTokens(ctx context.Context, selector api.ResumeTokenSelector) ([]api.ResumeToken, error)

PendingResumeTokens lists unconsumed resume tokens matching selector. After a crash, a host enumerates pending tokens with this and recovers each via RecoverResumeToken — the bulk-recovery entry point.

func (*Runner) PublishResponse added in v0.7.0

func (r *Runner) PublishResponse(ctx context.Context, cmd api.PublishResponseCommand) error

func (*Runner) QueryUsage added in v0.9.0

func (r *Runner) QueryUsage(ctx context.Context, selector api.UsageSelector) ([]api.UsageRecord, error)

QueryUsage returns the usage records matching selector.

func (*Runner) QueueEnvelope added in v0.7.0

func (r *Runner) QueueEnvelope(ctx context.Context, env api.TaskEnvelope) error

func (*Runner) QueueMessage added in v0.7.0

func (r *Runner) QueueMessage(ctx context.Context, message api.UserMessage) error

func (*Runner) QueueRun added in v0.7.0

func (r *Runner) QueueRun(ctx context.Context, cmd api.StartRunCommand) (api.Run, error)

func (*Runner) ReadyTasks deprecated added in v0.7.0

func (r *Runner) ReadyTasks(runID string) []api.Task

Deprecated: use ReadyTasksContext.

func (*Runner) ReadyTasksContext added in v0.10.0

func (r *Runner) ReadyTasksContext(ctx context.Context, runID string) []api.Task

func (*Runner) Recover added in v0.7.0

func (r *Runner) Recover(ctx context.Context, runID string) (api.Projection, error)

func (*Runner) RecoverResumeToken added in v0.7.0

func (r *Runner) RecoverResumeToken(ctx context.Context, cmd api.RecoverResumeTokenCommand) (api.ResumeToken, error)

func (*Runner) RegisterAgent added in v0.7.0

func (r *Runner) RegisterAgent(profile api.AgentProfile)

func (*Runner) RegisterFlow added in v0.7.0

func (r *Runner) RegisterFlow(flow api.Flow) error

func (*Runner) RegisterTool added in v0.7.0

func (r *Runner) RegisterTool(tool api.Tool)

func (*Runner) ReleaseTaskExecution added in v0.7.0

func (r *Runner) ReleaseTaskExecution(ctx context.Context, cmd api.ReleaseTaskExecutionCommand) error

func (*Runner) Replay deprecated added in v0.7.0

func (r *Runner) Replay(runID string, mode api.ReplayMode) (api.Projection, error)

Deprecated: use ReplayContext.

func (*Runner) ReplayContext added in v0.10.0

func (r *Runner) ReplayContext(ctx context.Context, runID string, mode api.ReplayMode) (api.Projection, error)

func (*Runner) ReplayRunState deprecated added in v0.7.0

func (r *Runner) ReplayRunState(runID string) (api.Projection, error)

Deprecated: use ReplayRunStateContext.

func (*Runner) ReplayRunStateContext added in v0.10.0

func (r *Runner) ReplayRunStateContext(ctx context.Context, runID string) (api.Projection, error)

func (*Runner) RequestApproval added in v0.7.0

func (*Runner) RequestHandoff added in v0.7.0

func (r *Runner) RequestHandoff(ctx context.Context, cmd api.HandoffCommand) error

func (*Runner) ResponseOutbox deprecated added in v0.7.0

func (r *Runner) ResponseOutbox(runID string) []api.UserMessage

Deprecated: use ResponseOutboxContext.

func (*Runner) ResponseOutboxContext added in v0.10.0

func (r *Runner) ResponseOutboxContext(ctx context.Context, runID string) []api.UserMessage

func (*Runner) ResumeTokens added in v0.7.0

func (r *Runner) ResumeTokens() map[string]api.ResumeToken

func (*Runner) Run added in v0.7.0

func (r *Runner) Run(ctx context.Context, runID string) (api.Run, error)

func (*Runner) RunEvents added in v0.7.0

func (r *Runner) RunEvents(ctx context.Context, runID string) ([]api.Event, error)

func (*Runner) RunTimeline added in v0.7.0

func (r *Runner) RunTimeline(ctx context.Context, runID string) ([]api.RunTimelineItem, error)

func (*Runner) SaveRun added in v0.7.0

func (r *Runner) SaveRun(ctx context.Context, run api.Run) error

func (*Runner) SaveTask added in v0.7.0

func (r *Runner) SaveTask(ctx context.Context, task api.Task) error

func (*Runner) SaveTraceSpan added in v0.7.0

func (r *Runner) SaveTraceSpan(ctx context.Context, span api.TraceSpan) error

func (*Runner) SelectItems added in v0.7.0

func (r *Runner) SelectItems(ctx context.Context, runID string, selector api.BlackboardSelector) ([]api.BlackboardItem, error)

func (*Runner) SetMessagePolicy added in v0.7.0

func (r *Runner) SetMessagePolicy(policy api.MessagePolicyChecker)

func (*Runner) SetOutputGateway added in v0.7.0

func (r *Runner) SetOutputGateway(gateway api.OutputGateway)

func (*Runner) SetPipeline added in v0.7.0

func (r *Runner) SetPipeline(components api.PipelineComponents)

func (*Runner) SetPolicyEngine added in v0.7.0

func (r *Runner) SetPolicyEngine(policy api.PolicyEngine)

func (*Runner) StartActionAttempt added in v0.7.0

func (r *Runner) StartActionAttempt(ctx context.Context, cmd api.StartActionAttemptCommand) (api.ActionAttempt, error)

func (*Runner) StartRun added in v0.7.0

func (r *Runner) StartRun(ctx context.Context, cmd api.StartRunCommand) (api.Run, api.Task, error)

func (*Runner) StartTraceSpan added in v0.7.0

func (r *Runner) StartTraceSpan(ctx context.Context, cmd api.StartTraceSpanCommand) (api.TraceSpan, error)

func (*Runner) StoreCapabilities added in v0.10.0

func (r *Runner) StoreCapabilities(ctx context.Context) (api.StoreCapabilities, error)

func (*Runner) StoreProvider added in v0.7.0

func (r *Runner) StoreProvider() api.StoreProvider

func (*Runner) SubmitResponseOutput added in v0.7.0

func (r *Runner) SubmitResponseOutput(ctx context.Context, cmd api.SubmitResponseOutputCommand) error

func (*Runner) SubmitTypedReport added in v0.7.0

func (r *Runner) SubmitTypedReport(ctx context.Context, cmd api.SubmitTypedReportCommand) error

func (*Runner) SubmitUserInput added in v0.7.0

func (r *Runner) SubmitUserInput(ctx context.Context, cmd api.SubmitUserInputCommand) error

func (*Runner) Subscribe added in v0.7.0

func (r *Runner) Subscribe(ctx context.Context, runID string, filter api.BlackboardFilter) (<-chan api.BlackboardItem, func() error, error)

Subscribe streams future blackboard writes for runID that match filter. The subscription ends when the returned cancel func is called or when ctx is cancelled — either way the underlying subscription is released and the channel closes; items in flight at that moment may be dropped. cancel is idempotent and safe to call after ctx cancellation.

func (*Runner) SumUsageCredits added in v0.9.0

func (r *Runner) SumUsageCredits(ctx context.Context, selector api.UsageSelector) (int64, error)

SumUsageCredits returns the credit sum over records matching selector.

func (*Runner) Task added in v0.7.0

func (r *Runner) Task(ctx context.Context, runID, taskID string) (api.Task, error)

func (*Runner) TraceSpans deprecated added in v0.7.0

func (r *Runner) TraceSpans(runID string) []api.TraceSpan

Deprecated: use ListTraceSpans so cancellation and storage errors are observable.

func (*Runner) TransitionRun added in v0.7.0

func (r *Runner) TransitionRun(ctx context.Context, cmd api.TransitionRunCommand) error

func (*Runner) TransitionTask added in v0.7.0

func (r *Runner) TransitionTask(ctx context.Context, cmd api.TransitionTaskCommand) error

func (*Runner) UpdateEnvelope added in v0.7.0

func (r *Runner) UpdateEnvelope(ctx context.Context, env api.TaskEnvelope) error

func (*Runner) UpdateMessage added in v0.7.0

func (r *Runner) UpdateMessage(ctx context.Context, message api.UserMessage) error

func (*Runner) WaitForBlackboard added in v0.7.0

func (r *Runner) WaitForBlackboard(ctx context.Context, runID string, filter api.BlackboardFilter, predicate func([]api.BlackboardItem) bool, timeout time.Duration) ([]api.BlackboardItem, error)

func (*Runner) WriteItem added in v0.7.0

func (r *Runner) WriteItem(ctx context.Context, item api.BlackboardItem) error

Directories

Path Synopsis
_examples
approval command
approval demonstrates the human-in-the-loop tool gate: a policy engine requires approval for any tool flagged RequiresActionTask, the runtime pauses, a human decides, and the call resumes.
approval demonstrates the human-in-the-loop tool gate: a policy engine requires approval for any tool flagged RequiresActionTask, the runtime pauses, a human decides, and the call resumes.
coding_hashline command
coding_hashline demonstrates the sandboxed coding capability end to end: a scripted agent reads a buggy Go file, fixes it with a line-anchored hashline edit, formats it with the in-process gofmt tool, runs the package tests, and shows the resulting git diff — all through the Runner/worker path under coding.PolicyEngine(), and with NO shell access.
coding_hashline demonstrates the sandboxed coding capability end to end: a scripted agent reads a buggy Go file, fixes it with a line-anchored hashline edit, formats it with the in-process gofmt tool, runs the package tests, and shows the resulting git diff — all through the Runner/worker path under coding.PolicyEngine(), and with NO shell access.
collab command
collab demonstrates handoff: agent A starts a task, decides B is the right owner, and transfers ownership via RequestHandoff.
collab demonstrates handoff: agent A starts a task, decides B is the right owner, and transfers ownership via RequestHandoff.
dataflow command
dataflow demonstrates blackboard read/write: producer task writes a finding, consumer task reads it via SelectItems.
dataflow demonstrates blackboard read/write: producer task writes a finding, consumer task reads it via SelectItems.
durable command
durable demonstrates event-sourced replay: after a run completes, ReplayRunState rebuilds the full projection from the event log alone.
durable demonstrates event-sourced replay: after a run completes, ReplayRunState rebuilds the full projection from the event log alone.
evaluation command
evaluation demonstrates the eval framework: declare an EvalCase with a scripted Harness and a few typed Assertions, then grade an executed run.
evaluation demonstrates the eval framework: declare an EvalCase with a scripted Harness and a few typed Assertions, then grade an executed run.
governed_tool command
governed_tool demonstrates policy-gated tool execution.
governed_tool demonstrates policy-gated tool execution.
incident_response command
Reference architecture: 用户 → 主控 → Blackboard → Mailbox → N 专家 → 归因 → 风险评审 → 处置.
Reference architecture: 用户 → 主控 → Blackboard → Mailbox → N 专家 → 归因 → 风险评审 → 处置.
mailbox_pingpong command
mailbox_pingpong shows the mailbox dispatch + ack primitive.
mailbox_pingpong shows the mailbox dispatch + ack primitive.
orchestrator command
panel command
panel demonstrates AwaitMode=Quorum: a synthesizer task unblocks once 2 of 3 panel experts succeed.
panel demonstrates AwaitMode=Quorum: a synthesizer task unblocks once 2 of 3 panel experts succeed.
recipes/collab command
Recipe: collab — multi-branch parallel work where each branch hands off from implementer to reviewer.
Recipe: collab — multi-branch parallel work where each branch hands off from implementer to reviewer.
recipes/deepsearch command
Recipe: deepsearch — research + verification stage gated by AwaitMode=All.
Recipe: deepsearch — research + verification stage gated by AwaitMode=All.
recipes/panel command
Recipe: panel — domain experts each tagged by Role.
Recipe: panel — domain experts each tagged by Role.
recipes/research command
Recipe: research — N parallel researchers contribute evidence, a supervisor waits for the corpus, then synthesizes a finding.
Recipe: research — N parallel researchers contribute evidence, a supervisor waits for the corpus, then synthesizes a finding.
recipes/verifier command
verifier demonstrates feedback-loop engineering on the Hydaelyn agent layer: a writer agent drafts an answer, a verifier subagent checks it against a rubric, and the writer revises on the verifier's feedback until it passes.
verifier demonstrates feedback-loop engineering on the Hydaelyn agent layer: a writer agent drafts an answer, a verifier subagent checks it against a rubric, and the writer revises on the verifier's feedback until it passes.
research command
research demonstrates fan-out by group.
research demonstrates fan-out by group.
skills command
subagent command
subagent demonstrates the self-sufficient agent layer (ADR-018): one parent agent delegates to two subagents, each running on a different model served by a different vendor, through a single provider.Registry and a single agent.Build path.
subagent demonstrates the self-sufficient agent layer (ADR-018): one parent agent delegates to two subagents, each running on a different model served by a different vendor, through a single provider.Registry and a single agent.Build path.
tooling command
tooling demonstrates the tool registration + invocation primitive: a read-effect tool runs through the policy gate without approval, and the runtime records a ToolInvocationResult on the run timeline.
tooling demonstrates the tool registration + invocation primitive: a read-effect tool runs through the policy gate without approval, and the runtime records a ToolInvocationResult on the run timeline.
worker command
worker demonstrates the optional AgentWorker glue.
worker demonstrates the optional AgentWorker glue.
workflow command
Package blackboard exposes only the stable item and selector contracts used by the Hydaelyn runtime.
Package blackboard exposes only the stable item and selector contracts used by the Hydaelyn runtime.
cmd
hydaelyn command
Package coding is the reusable coding-agent toolkit: the coding.* tool.Drivers (read_file, search, edit_hashline, write_file, gofmt, gotest), the Workspace filesystem abstraction, and the hashline snapshot store behind stale-edit detection.
Package coding is the reusable coding-agent toolkit: the coding.* tool.Drivers (read_file, search, edit_hashline, write_file, gofmt, gotest), the Workspace filesystem abstraction, and the hashline snapshot store behind stale-edit detection.
internal/hashline
Package hashline implements the pure-Go core of the hashline line-anchored edit protocol: file normalization, the FNV tag fingerprint, the numbered read/edit formats, a strict patch parser, an original-line-anchored applier, and an all-or-nothing multi-section patcher.
Package hashline implements the pure-Go core of the hashline line-anchored edit protocol: file normalization, the FNV tag fingerprint, the numbered read/edit formats, a strict patch parser, an original-line-anchored applier, and an all-or-nothing multi-section patcher.
internal/workspace
Package workspace provides low-level sandbox helpers for the coding capability: workspace-relative path resolution, an argv command allowlist and runner, and a bounded file-listing walker.
Package workspace provides low-level sandbox helpers for the coding capability: workspace-relative path resolution, an argv command allowlist and runner, and a bounded file-listing walker.
Package contract provides public conformance tests for application-owned api.StoreProvider implementations.
Package contract provides public conformance tests for application-owned api.StoreProvider implementations.
internal/inmemfake
Package inmemfake provides a non-exported in-memory api.StoreProvider used solely by the framework's own contract-suite self-test in contract/contract_test.go.
Package inmemfake provides a non-exported in-memory api.StoreProvider used solely by the framework's own contract-suite self-test in contract/contract_test.go.
Package eval is the v0.8.0 evaluation framework.
Package eval is the v0.8.0 evaluation framework.
assertions
Package assertions ships the framework's built-in eval.Assertion implementations.
Package assertions ships the framework's built-in eval.Assertion implementations.
matcher
Package matcher ships the framework's built-in value comparators used by eval assertions (most notably ToolCalledWithArg and OutputContains).
Package matcher ships the framework's built-in value comparators used by eval assertions (most notably ToolCalledWithArg and OutputContains).
reporter
Package reporter renders a slice of eval.EvalResult into the formats CI and humans consume: JUnit XML (junit.go), GitHub Checks annotations (github.go), and a terminal-friendly summary (text.go).
Package reporter renders a slice of eval.EvalResult into the formats CI and humans consume: JUnit XML (junit.go), GitHub Checks annotations (github.go), and a terminal-friendly summary (text.go).
Package flow exposes orchestrator flow presets.
Package flow exposes orchestrator flow presets.
internal
cli
Package cli implements the deliberately minimal hydaelyn binary.
Package cli implements the deliberately minimal hydaelyn binary.
compact
Package compact provides conversation compaction strategies for managing context window growth.
Package compact provides conversation compaction strategies for managing context window growth.
core/adapter
Package adapter is the only bidirectional bridge between the public api types and the internal core model.
Package adapter is the only bidirectional bridge between the public api types and the internal core model.
core/governance
Package governance provides pure policy-effect helpers that operate only through ports.UnitOfWork.
Package governance provides pure policy-effect helpers that operate only through ports.UnitOfWork.
errs
Package errs provides structured error types used across the framework.
Package errs provides structured error types used across the framework.
gate
Package gate provides concurrency and ordering primitives for transport and messaging layers.
Package gate provides concurrency and ordering primitives for transport and messaging layers.
run
Package memory is the optional-plugin memory surface for v0.8.0+.
Package memory is the optional-plugin memory surface for v0.8.0+.
Package multiagent is the v0.8.0 multi-agent layer.
Package multiagent is the v0.8.0 multi-agent layer.
Package packs is the v0.8.0 "vertical pack" registry root.
Package packs is the v0.8.0 "vertical pack" registry root.
aiops
Package aiops is a v0.8.0 skeleton pack for production-monitoring style agents: alert triage, log search, runbook execution.
Package aiops is a v0.8.0 skeleton pack for production-monitoring style agents: alert triage, log search, runbook execution.
coding
Package coding is the declarative manifest for the sandboxed coding capability specified in docs/coding-agent-hashline.md.
Package coding is the declarative manifest for the sandboxed coding capability specified in docs/coding-agent-hashline.md.
customersupport
Package customersupport is a v0.8.0 skeleton pack that bundles a triage agent plus the capability shape a typical support workflow needs (ticket lookup, knowledge-base search, reply drafting).
Package customersupport is a v0.8.0 skeleton pack that bundles a triage agent plus the capability shape a typical support workflow needs (ticket lookup, knowledge-base search, reply drafting).
devops
Package devops is a v0.8.0 skeleton pack for build/release/operate style agents: a deploy assistant, a release-notes drafter, and a log-triage helper.
Package devops is a v0.8.0 skeleton pack for build/release/operate style agents: a deploy assistant, a release-notes drafter, and a log-triage helper.
research
Package research is the v0.8.0 worked-example pack: a small bundle of agent definitions, capabilities, and an eval suite that demonstrates the shape every pack should follow.
Package research is the v0.8.0 worked-example pack: a small bundle of agent definitions, capabilities, and an eval suite that demonstrates the shape every pack should follow.
Package policy exposes the stable authorization contract used by the Hydaelyn runner.
Package policy exposes the stable authorization contract used by the Hydaelyn runner.
Package skill parses and registers Agent Skills-compatible instruction bundles.
Package skill parses and registers Agent Skills-compatible instruction bundles.
Package stream is the consumer-facing streaming surface for the agent loop.
Package stream is the consumer-facing streaming surface for the agent loop.
kit
transport
cron
Package cron is the cron transport driver for api.TriggerSchedule.
Package cron is the cron transport driver for api.TriggerSchedule.
event
Package event is the in-process pub/sub transport driver for api.TriggerEvent.
Package event is the in-process pub/sub transport driver for api.TriggerEvent.
mcp
mcp/client
Package mcpclient implements a typed Model Context Protocol client.
Package mcpclient implements a typed Model Context Protocol client.
scheduler
Package scheduler is a deprecated compatibility shim for the cron trigger transport.
Package scheduler is a deprecated compatibility shim for the cron trigger transport.
sse
Package sse adapts a live stream.Frame stream onto a Server-Sent Events HTTP response.
Package sse adapts a live stream.Frame stream onto a Server-Sent Events HTTP response.
trigger
Package trigger declares the small set of types shared across every transport driver under transport/* (scheduler, webhook, event).
Package trigger declares the small set of types shared across every transport driver under transport/* (scheduler, webhook, event).
webhook
Package webhook is the HTTP transport driver for api.TriggerWebhook.
Package webhook is the HTTP transport driver for api.TriggerWebhook.
Package worker provides optional glue between the Hydaelyn runner and the single-agent engine.
Package worker provides optional glue between the Hydaelyn runner and the single-agent engine.
Package workflow provides a user-facing workflow modeling layer.
Package workflow provides a user-facing workflow modeling layer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL