recording

package
v2.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package recording wraps an adkmodel.LLM with a JSONL transcript recorder for offline observability and scripted-replay testing.

The recording wrapper (NewRecorder) is transparent: callers see the inner LLM's responses unchanged, and one RecordedTurn is appended to the writer per GenerateContent call. The same RecordedTurn type is consumed by models/mock's scripted provider for deterministic replay.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRecorder

func NewRecorder(inner adkmodel.LLM, w io.Writer) adkmodel.LLM

NewRecorder wraps inner so every GenerateContent turn is appended to w as a single JSONL line in RecordedTurn shape. The wrapper is transparent: callers see the inner LLM's responses unchanged. The caller owns w's lifecycle (open before, close after).

Errors from the inner LLM pass through to the caller but are not recorded — replay can't reproduce a remote error meaningfully. Partial responses received before an error are still encoded.

Types

type RecordedTurn

type RecordedTurn struct {
	Request   *adkmodel.LLMRequest    `json:"request"`
	Responses []*adkmodel.LLMResponse `json:"responses"`
}

RecordedTurn is the on-disk shape of a single LLM turn captured by the recording wrapper and consumed by the scripted provider.

One RecordedTurn is written per JSONL line. Request is a snapshot taken before the inner LLM may have mutated it (Config.Tools is commonly appended to). Responses is the full ordered stream of LLMResponse values yielded for that turn — typically zero or more Partial: true chunks followed by exactly one TurnComplete: true.

Note that adkmodel.LLMRequest.Tools is tagged json:"-" upstream and will silently drop on serialization. That's intentional: the inner LLM provides tool declarations on replay; recorded Tools would be dead weight.

Jump to

Keyboard shortcuts

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