Versions in this module Expand all Collapse all v0 v0.1.0 Sep 1, 2026 Changes in this version + const SourceTypeContextProvider + const SourceTypeHistoryProvider + const SourceTypeMiddleware + func AllOptions[T any](opts []Option, setter func(T) Option) iter.Seq[T] + func GetOption[T any](opts []Option, setter func(T) Option) (T, bool) + type Agent struct + func AgentFromContext(ctx context.Context) (*Agent, bool) + func New(prov ProviderConfig, cfg Config) *Agent + func (a *Agent) CreateSession(ctx context.Context, options ...Option) (*Session, error) + func (a *Agent) Description() string + func (a *Agent) ID() string + func (a *Agent) Name() string + func (a *Agent) ProviderName() string + func (a *Agent) Run(ctx context.Context, messages []*message.Message, options ...Option) ResponseStream + func (a *Agent) RunMessage(ctx context.Context, msg *message.Message, options ...Option) ResponseStream + func (a *Agent) RunText(ctx context.Context, msg string, options ...Option) ResponseStream + type Config struct + ClearOnHistoryProviderConflict *bool + ContextProviders []ContextProvider + Description string + DisableRunLogs bool + HistoryProvider HistoryProvider + ID string + LogSensitiveData bool + Logger *slog.Logger + MessageInjector *MessageInjector + Middlewares []Middleware + Name string + RunOptions []Option + ThrowOnHistoryProviderConflict *bool + Tools []tool.Tool + WarnOnHistoryProviderConflict *bool + type ContextProvider interface + Invoked func(context.Context, InvokedContext) error + Invoking func(context.Context, InvokingContext) ([]*message.Message, []Option, error) + func NewContextProvider(config ContextProviderConfig) ContextProvider + type ContextProviderConfig struct + Provide func(context.Context, InvokingContext) ([]*message.Message, []Option, error) + ProvideInputMessageFilter messagefilter.Filter + SourceID string + Store func(context.Context, InvokedContext) error + StoreInputRequestMessageFilter messagefilter.Filter + StoreInputResponseMessageFilter messagefilter.Filter + type HistoryProvider interface + Invoked func(context.Context, InvokedContext) error + Invoking func(context.Context, InvokingContext) ([]*message.Message, error) + func NewHistoryProvider(config HistoryProviderConfig) HistoryProvider + func NewInMemoryHistoryProvider(config InMemoryHistoryProviderConfig) HistoryProvider + type HistoryProviderConfig struct + Provide func(context.Context, InvokingContext) ([]*message.Message, error) + ProvideOutputMessageFilter messagefilter.Filter + SourceID string + Store func(context.Context, InvokedContext) error + StoreInputRequestMessageFilter messagefilter.Filter + StoreInputResponseMessageFilter messagefilter.Filter + type InMemoryHistoryProviderConfig struct + ProvideOutputMessageFilter messagefilter.Filter + SourceID string + StateInitializer func(*Session) []*message.Message + StateKey string + StoreInputRequestMessageFilter messagefilter.Filter + StoreInputResponseMessageFilter messagefilter.Filter + type InvokedContext struct + Err error + Options []Option + RequestMessages []*message.Message + ResponseMessages []*message.Message + type InvokingContext struct + Messages []*message.Message + Options []Option + type MessageInjector struct + func (m *MessageInjector) EnqueueMessages(session *Session, messages ...*message.Message) error + func (m *MessageInjector) PendingMessages(session *Session) ([]*message.Message, error) + type Middleware interface + Run func(next RunFunc, ctx context.Context, messages []*message.Message, ...) iter.Seq2[*ResponseUpdate, error] + func ContextProviderMiddleware(p ContextProvider) Middleware + type MiddlewareFunc func(next RunFunc, ctx context.Context, messages []*message.Message, ...) iter.Seq2[*ResponseUpdate, error] + func (mf MiddlewareFunc) Run(next RunFunc, ctx context.Context, messages []*message.Message, ...) iter.Seq2[*ResponseUpdate, error] + type Option interface + MAFValue func() any + func AllowBackgroundResponses(allow bool) Option + func Stream(stream bool) Option + func WithContinuationToken(token string) Option + func WithInstructions(instructions string) Option + func WithResponseFormat(format ResponseFormat) Option + func WithServiceID(id string) Option + func WithSession(session *Session) Option + func WithStructuredOutput(v any) Option + func WithTool(tool tool.Tool) Option + func WithToolMode(mode tool.ToolMode) Option + type ProviderConfig struct + CreateSession func(ctx context.Context, session *Session, options ...Option) error + Format func(v any) (ResponseFormat, error) + Middlewares []Middleware + ProviderName string + Run RunFunc + ServiceDoesNotManageHistory bool + Unmarshal func(format ResponseFormat, data []byte, v any) error + type Response struct + AdditionalProperties map[string]any + AgentID string + ContinuationToken string + CreatedAt time.Time + FinishReason string + ID string + Messages []*message.Message + RawRepresentation any + func (resp *Response) Coalesce() + func (resp *Response) Contents() iter.Seq[message.Content] + func (resp *Response) String() string + func (resp *Response) ToUpdates() []*ResponseUpdate + func (resp *Response) Update(update *ResponseUpdate) + func (resp *Response) Usage() message.UsageDetails + type ResponseFormat struct + Description string + Kind string + Name string + Schema any + Strict bool + type ResponseStream iter.Seq2[*ResponseUpdate, error] + func (r ResponseStream) Collect() (*Response, error) + type ResponseUpdate struct + AdditionalProperties map[string]any + AgentID string + AuthorName string + Contents message.Contents + ContinuationToken string + CreatedAt time.Time + FinishReason string + MessageID string + RawRepresentation any + ResponseID string + Role message.Role + func (m *ResponseUpdate) Usage() message.UsageDetails + func (r *ResponseUpdate) String() string + type RunFunc = func(ctx context.Context, messages []*message.Message, options ...Option) iter.Seq2[*ResponseUpdate, error] + type Session struct + func (s *Session) Delete(key string) + func (s *Session) Get(key string, value any) (bool, error) + func (s *Session) ServiceID() string + func (s *Session) Set(key string, value any) + func (s *Session) SetServiceID(id string) + func (s *Session) UnmarshalJSON(data []byte) error + func (s Session) MarshalJSON() ([]byte, error)