agentstesting

package
v0.9.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFinalOutputMessage

func GetFinalOutputMessage(args string) responses.ResponseOutputItemUnion

func GetFunctionTool

func GetFunctionTool(name string, returnValue string) agents.FunctionTool

func GetFunctionToolCall

func GetFunctionToolCall(name string, arguments string) responses.ResponseOutputItemUnion

func GetFunctionToolErr

func GetFunctionToolErr(name string, returnErr error) agents.FunctionTool

func GetHandoffToolCall

func GetHandoffToolCall(
	toAgent *agents.Agent,
	overrideName string,
	args string,
) responses.ResponseOutputItemUnion

func GetResponseObj

func GetResponseObj(
	output []agents.TResponseOutputItem,
	responseID string,
	u *usage.Usage,
) responses.Response

func GetTextInputItem

func GetTextInputItem(content string) agents.TResponseInputItem

func GetTextMessage

func GetTextMessage(content string) responses.ResponseOutputItemUnion

Types

type FakeMCPPromptServer

type FakeMCPPromptServer struct {
	Prompts       []*mcp.Prompt
	PromptResults map[string]string
	// contains filtered or unexported fields
}

FakeMCPPromptServer is a fake MCP server for testing prompt functionality.

func NewFakeMCPPromptServer

func NewFakeMCPPromptServer(serverName string) *FakeMCPPromptServer

func (*FakeMCPPromptServer) AddPrompt

func (s *FakeMCPPromptServer) AddPrompt(name, description string, arguments []*mcp.PromptArgument)

AddPrompt adds a prompt to the fake server

func (*FakeMCPPromptServer) CallTool

func (*FakeMCPPromptServer) Cleanup

func (*FakeMCPPromptServer) Connect

func (*FakeMCPPromptServer) GetPrompt

func (s *FakeMCPPromptServer) GetPrompt(_ context.Context, name string, arguments map[string]string) (*mcp.GetPromptResult, error)

func (*FakeMCPPromptServer) ListPrompts

func (*FakeMCPPromptServer) ListTools

func (s *FakeMCPPromptServer) ListTools(context.Context, *agents.Agent) ([]*mcp.Tool, error)

func (*FakeMCPPromptServer) Name

func (s *FakeMCPPromptServer) Name() string

func (*FakeMCPPromptServer) SetPromptResult

func (s *FakeMCPPromptServer) SetPromptResult(name, result string)

SetPromptResult sets the result that should be returned for a prompt.

func (*FakeMCPPromptServer) UseStructuredContent

func (s *FakeMCPPromptServer) UseStructuredContent() bool

type FakeMCPServer

type FakeMCPServer struct {
	Tools       []*mcp.Tool
	ToolCalls   []string
	ToolResults []string
	ToolFilter  agents.MCPToolFilter
	// contains filtered or unexported fields
}

func NewFakeMCPServer

func NewFakeMCPServer(
	tools []*mcp.Tool,
	toolFilter agents.MCPToolFilter,
	name string,
) *FakeMCPServer

func (*FakeMCPServer) AddTool

func (s *FakeMCPServer) AddTool(name string, inputSchema *jsonschema.Schema)

func (*FakeMCPServer) CallTool

func (s *FakeMCPServer) CallTool(_ context.Context, toolName string, arguments map[string]any) (*mcp.CallToolResult, error)

func (*FakeMCPServer) Cleanup

func (s *FakeMCPServer) Cleanup(context.Context) error

func (*FakeMCPServer) Connect

func (s *FakeMCPServer) Connect(context.Context) error

func (*FakeMCPServer) GetPrompt

func (s *FakeMCPServer) GetPrompt(_ context.Context, name string, _ map[string]string) (*mcp.GetPromptResult, error)

GetPrompt returns a simple prompt result for fake server.

func (*FakeMCPServer) ListPrompts

ListPrompts returns empty list of prompts for fake server.

func (*FakeMCPServer) ListTools

func (s *FakeMCPServer) ListTools(ctx context.Context, agent *agents.Agent) ([]*mcp.Tool, error)

func (*FakeMCPServer) Name

func (s *FakeMCPServer) Name() string

func (*FakeMCPServer) UseStructuredContent

func (s *FakeMCPServer) UseStructuredContent() bool

type FakeModel

type FakeModel struct {
	TracingEnabled bool
	TurnOutputs    []FakeModelTurnOutput
	LastTurnArgs   FakeModelLastTurnArgs
	FirstTurnArgs  *FakeModelLastTurnArgs
	HardcodedUsage *usage.Usage
	ResponseID     string
}

func NewFakeModel

func NewFakeModel(tracingEnabled bool, initialOutput *FakeModelTurnOutput) *FakeModel

func (*FakeModel) AddMultipleTurnOutputs

func (m *FakeModel) AddMultipleTurnOutputs(outputs []FakeModelTurnOutput)

func (*FakeModel) GetNextOutput

func (m *FakeModel) GetNextOutput() FakeModelTurnOutput

func (*FakeModel) GetResponse

func (m *FakeModel) GetResponse(ctx context.Context, params agents.ModelResponseParams) (*agents.ModelResponse, error)

func (*FakeModel) SetHardcodedUsage

func (m *FakeModel) SetHardcodedUsage(u usage.Usage)

func (*FakeModel) SetNextOutput

func (m *FakeModel) SetNextOutput(output FakeModelTurnOutput)

func (*FakeModel) StreamResponse

type FakeModelLastTurnArgs

type FakeModelLastTurnArgs struct {
	SystemInstructions param.Opt[string]
	Input              agents.Input
	ModelSettings      modelsettings.ModelSettings
	Tools              []agents.Tool
	OutputType         agents.OutputTypeInterface
	// optional
	PreviousResponseID string
	ConversationID     string
}

type FakeModelTurnOutput

type FakeModelTurnOutput struct {
	Value []agents.TResponseOutputItem
	Error error
}

Jump to

Keyboard shortcuts

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