with-subagent

command
v2.8.0-dev.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

with-subagent — parent + research subagent with a shared audit log

What this shows

A parent agent that delegates to a research subagent via agent.WithSubagents, end-to-end with no LLM credentials: two scripted-mock providers replay JSONL transcripts (parent calls the subagent as a tool, subagent answers, parent summarizes). Both agents share one SQLite eventlog handle, so the subagent's events land in the parent's session tree under branch="research" — the example finishes by streaming the full audit log to show the branch-tagged rows.

Run it

No credentials needed, runs offline:

go run ./examples/with-subagent

Key APIs

  • agent.WithSubagents / agent.WithEventLog / agent.WithSessiongithub.com/go-steer/core-agent/v2/pkg/agent
  • mock.NewScriptedgithub.com/go-steer/core-agent/v2/pkg/models/mock
  • eventlog.Open / eventlog.WithSessionTreegithub.com/go-steer/core-agent/v2/pkg/eventlog

What you should see

== parent run ==
  → research(map[request:what does the project ship])
  ← research -> map[...]
  text: The project ships an autonomous-run driver and a durable event log.

== full session tree (parent + every subagent) ==
  seq=1 branch=(root)     author=user
  ...
  seq=N branch=research   author=research

The subagent runs in a derived session row (parent-session:sub:research); WithSessionTree returns parent + descendants in one query.

Next

Documentation

Overview

Example: drive a parent agent with a subagent end-to-end with no LLM credentials. Two scripted-mock providers — one for the parent, one for the research subagent — replay JSONL transcripts that capture: parent calls subagent, subagent returns its answer, parent emits a final summary.

Both agents share an eventlog handle; the research subagent's events land in the parent's session row under branch="research" so an audit query against the parent session returns both. We inspect the resulting SQLite database at the end to show the agent_eventlog rows tagged by branch.

go run ./examples/with-subagent

Jump to

Keyboard shortcuts

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