agent

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithChatOptions

func WithChatOptions(chatOpts []ChatOption) adk.AgentRunOption

Types

type Agent

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

func NewAgent

func NewAgent(ctx context.Context, cm model.ToolCallingChatModel, opts ...Option) (*Agent, error)

func NewAgentFromADK

func NewAgentFromADK(adkAgent adk.Agent, opts ...Option) (*Agent, error)

NewAgentFromADK 从已存在的adk.Agent创建Agent实例 适用于已经通过adk包创建的Agent

func (*Agent) Description

func (this *Agent) Description(ctx context.Context) string

func (*Agent) Generate

func (this *Agent) Generate(ctx context.Context, input []*schema.Message, opts ...ChatOption) (*schema.Message, error)

Generate 生成完整响应(非流式) 性能优化:预分配内存,异步存储消息

func (*Agent) GetAdkAgent

func (this *Agent) GetAdkAgent() adk.Agent

func (*Agent) Name

func (this *Agent) Name(ctx context.Context) string

func (*Agent) Run

func (this *Agent) Run(ctx context.Context, input *adk.AgentInput, options ...adk.AgentRunOption) *adk.AsyncIterator[*adk.AgentEvent]

Run adk的Run入口 性能优化:预分配内存,异步存储消息

func (*Agent) Stream

func (this *Agent) Stream(ctx context.Context, input []*schema.Message, opts ...ChatOption) (*schema.StreamReader[*schema.Message], error)

Stream 流式输出,如果需要输出具体的agent流转详情等,建议使用Run方法

type ChatOption

type ChatOption func(*chatOptions)

func WithChatComposeOptions

func WithChatComposeOptions(composeOptions []compose.Option) ChatOption

func WithChatSessionID

func WithChatSessionID(sessionID string) ChatOption

func WithChatTools

func WithChatTools(tools []tool.BaseTool) ChatOption

func WithChatUserID

func WithChatUserID(userID string) ChatOption

func WithUserMessageSuffix

func WithUserMessageSuffix(suffix string) ChatOption

WithUserMessageSuffix 添加用户消息后缀

type Option

type Option func(*Agent)

func WithDescription

func WithDescription(description string) Option

func WithMaxStep

func WithMaxStep(maxStep int) Option

func WithMemoryManager

func WithMemoryManager(memoryManager *memory.MemoryManager) Option

func WithName

func WithName(name string) Option

func WithSubAgent

func WithSubAgent(agents []adk.Agent) Option

func WithSystemPrompt

func WithSystemPrompt(systemPrompt string) Option

func WithTools

func WithTools(tools []tool.BaseTool) Option

Jump to

Keyboard shortcuts

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