agenttest

package
v0.0.0-...-f97c3c1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package agenttest provides in-memory implementations of agent-related interfaces for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInMemorySession

func NewInMemorySession(id, appName, userID string, state session.State, events session.Events, lastUpdateTime time.Time) session.Session

NewInMemorySession creates a new InMemorySession with the given parameters.

func NewSessionInvocationContext

func NewSessionInvocationContext(ctx context.Context, sess session.Session) agent.InvocationContext

NewSessionInvocationContext creates a new SessionInvocationContext with the given session.

func NewToolContext

func NewToolContext(ctx context.Context, state session.State, actions *session.EventActions, funcCall string, readonlyState session.ReadonlyState) tool.Context

NewToolContext creates a new ToolContext with the given parameters.

Types

type InMemoryEvents

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

InMemoryEvents is a simple in-memory implementation of session.Events for testing.

func (*InMemoryEvents) All

func (e *InMemoryEvents) All() iter.Seq[*session.Event]

All implements session.Events.

func (*InMemoryEvents) At

func (e *InMemoryEvents) At(i int) *session.Event

At implements session.Events.

func (*InMemoryEvents) Len

func (e *InMemoryEvents) Len() int

Len implements session.Events.

type InMemorySession

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

InMemorySession is a simple in-memory implementation of session.Session for testing.

func (*InMemorySession) AppName

func (s *InMemorySession) AppName() string

AppName implements session.Session.

func (*InMemorySession) Events

func (s *InMemorySession) Events() session.Events

Events implements session.Session.

func (*InMemorySession) ID

func (s *InMemorySession) ID() string

ID implements session.Session.

func (*InMemorySession) LastUpdateTime

func (s *InMemorySession) LastUpdateTime() time.Time

LastUpdateTime implements session.Session.

func (*InMemorySession) State

func (s *InMemorySession) State() session.State

State implements session.Session.

func (*InMemorySession) UserID

func (s *InMemorySession) UserID() string

UserID implements session.Session.

type InMemoryState

type InMemoryState struct {
	GetErr error
	SetErr error
	// contains filtered or unexported fields
}

InMemoryState is a simple in-memory implementation of session.State for testing.

func NewInMemoryState

func NewInMemoryState(v map[string]any) *InMemoryState

NewInMemoryState creates a new InMemoryState with the given initial values.

func (*InMemoryState) All

func (s *InMemoryState) All() iter.Seq2[string, any]

All implements session.State.

func (*InMemoryState) Get

func (s *InMemoryState) Get(key string) (any, error)

Get implements session.State.

func (*InMemoryState) Set

func (s *InMemoryState) Set(key string, value any) error

Set implements session.State.

type SessionInvocationContext

type SessionInvocationContext struct {
	context.Context
	// contains filtered or unexported fields
}

SessionInvocationContext is a simple implementation of agent.InvocationContext for testing.

func (*SessionInvocationContext) Agent

Agent implements agent.InvocationContext.

func (*SessionInvocationContext) Artifacts

func (c *SessionInvocationContext) Artifacts() agent.Artifacts

Artifacts implements agent.InvocationContext.

func (*SessionInvocationContext) Branch

func (c *SessionInvocationContext) Branch() string

Branch implements agent.InvocationContext.

func (*SessionInvocationContext) EndInvocation

func (c *SessionInvocationContext) EndInvocation()

EndInvocation implements agent.InvocationContext.

func (*SessionInvocationContext) Ended

func (c *SessionInvocationContext) Ended() bool

Ended implements agent.InvocationContext.

func (*SessionInvocationContext) InvocationID

func (c *SessionInvocationContext) InvocationID() string

InvocationID implements agent.InvocationContext.

func (*SessionInvocationContext) Memory

Memory implements agent.InvocationContext.

func (*SessionInvocationContext) RunConfig

func (c *SessionInvocationContext) RunConfig() *agent.RunConfig

RunConfig implements agent.InvocationContext.

func (*SessionInvocationContext) Session

Session implements agent.InvocationContext.

func (*SessionInvocationContext) UserContent

func (c *SessionInvocationContext) UserContent() *genai.Content

UserContent implements agent.InvocationContext.

type ToolContext

type ToolContext struct {
	context.Context
	// contains filtered or unexported fields
}

ToolContext is a simple implementation of tool.Context for testing.

func (*ToolContext) Actions

func (c *ToolContext) Actions() *session.EventActions

Actions implements tool.Context.

func (*ToolContext) AgentName

func (c *ToolContext) AgentName() string

AgentName implements tool.Context.

func (*ToolContext) AppName

func (c *ToolContext) AppName() string

AppName implements tool.Context.

func (*ToolContext) Artifacts

func (c *ToolContext) Artifacts() agent.Artifacts

Artifacts implements tool.Context.

func (*ToolContext) Branch

func (c *ToolContext) Branch() string

Branch implements tool.Context.

func (*ToolContext) FunctionCallID

func (c *ToolContext) FunctionCallID() string

FunctionCallID implements tool.Context.

func (*ToolContext) InvocationID

func (c *ToolContext) InvocationID() string

InvocationID implements tool.Context.

func (*ToolContext) ReadonlyState

func (c *ToolContext) ReadonlyState() session.ReadonlyState

ReadonlyState implements tool.Context.

func (*ToolContext) SearchMemory

SearchMemory implements tool.Context.

func (*ToolContext) SessionID

func (c *ToolContext) SessionID() string

SessionID implements tool.Context.

func (*ToolContext) State

func (c *ToolContext) State() session.State

State implements tool.Context.

func (*ToolContext) UserContent

func (c *ToolContext) UserContent() *genai.Content

UserContent implements tool.Context.

func (*ToolContext) UserID

func (c *ToolContext) UserID() string

UserID implements tool.Context.

Jump to

Keyboard shortcuts

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