Help us shape the future of Go! Take the 2026 Go Developer Survey

agenttest

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ContinuationTokenType = "agentContinuationToken"

Variables

This section is empty.

Functions

func AgentRunResponseUpdatesEqual

func AgentRunResponseUpdatesEqual(expected, actual []*agent.ResponseUpdate) error

func CreateSession

func CreateSession(options ...agent.Option) *agent.Session

func EncodeContinuationToken

func EncodeContinuationToken(t testing.TB, token ContinuationToken) string

func MessagesEqual

func MessagesEqual(expected, actual []*message.Message) error

func New

func New(responses []Turn) *agent.Agent

func NewContinuationToken

func NewContinuationToken(t testing.TB, innerToken string) string

func ResponseUpdateEqual

func ResponseUpdateEqual(got, want *agent.ResponseUpdate) error

func ResponseUpdatesEqual

func ResponseUpdatesEqual(got, want []*agent.ResponseUpdate) error

Types

type ContinuationToken

type ContinuationToken struct {
	Type            string                  `json:"type"`
	InnerToken      string                  `json:"innerToken"`
	InputMessages   []*message.Message      `json:"inputMessages,omitempty"`
	ResponseUpdates []*agent.ResponseUpdate `json:"responseUpdates,omitempty"`
}

func DecodeContinuationToken

func DecodeContinuationToken(t testing.TB, token string) ContinuationToken

type Middleware

type Middleware struct {
	PreResponses  []Turn
	PostResponses []Turn
	// contains filtered or unexported fields
}

Middleware is a test implementation of the Middleware interface

func (*Middleware) Called

func (m *Middleware) Called() bool

func (*Middleware) Run

func (m *Middleware) Run(next agent.RunFunc, ctx context.Context, messages []*message.Message, opts ...agent.Option) iter.Seq2[*agent.ResponseUpdate, error]

type Response

type Response struct {
	Response *agent.ResponseUpdate
	Error    error
}

type ResponseBuilder

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

func NewResponseBuilder

func NewResponseBuilder(firstTurnCallbacks ...func(ctx context.Context, messages []*message.Message, opts ...agent.Option)) *ResponseBuilder

func (*ResponseBuilder) Add

func (*ResponseBuilder) AddError

func (rb *ResponseBuilder) AddError(err error) *ResponseBuilder

func (*ResponseBuilder) AddFunctionCall

func (rb *ResponseBuilder) AddFunctionCall(callID, name string, arguments string) *ResponseBuilder

func (*ResponseBuilder) AddText

func (rb *ResponseBuilder) AddText(text string) *ResponseBuilder

func (*ResponseBuilder) Build

func (rb *ResponseBuilder) Build() []Turn

func (*ResponseBuilder) NewTurn

func (rb *ResponseBuilder) NewTurn(callbacks ...func(ctx context.Context, messages []*message.Message, opts ...agent.Option)) *ResponseBuilder

type Runner

type Runner struct {
	Responses []Turn
	// contains filtered or unexported fields
}

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, messages []*message.Message, opts ...agent.Option) iter.Seq2[*agent.ResponseUpdate, error]

type Tool

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

Tool is a test implementation of the Tool interface

func NewTool

func NewTool(name, description string) *Tool

func (*Tool) Description

func (t *Tool) Description() string

func (*Tool) Name

func (t *Tool) Name() string

type Turn

type Turn struct {
	Callbacks []func(context.Context, []*message.Message, ...agent.Option)
	Responses []Response
}

Jump to

Keyboard shortcuts

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