todo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package todo provides a context provider that gives agents todo list management tools for tracking work items during long-running complex tasks.

The provider exposes five tools to the agent: todos_add, todos_complete, todos_remove, todos_get_remaining, and todos_get_all.

Todo state is stored in the agent session and persists across invocations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompleteInput

type CompleteInput struct {
	ID     int    `json:"id"`
	Reason string `json:"reason"`
}

CompleteInput is the input structure for completing a single todo item. It carries the item ID and a reason describing how or why the item was completed.

type Item

type Item struct {
	ID          int    `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	IsComplete  bool   `json:"isComplete"`
}

Item represents a single todo item.

type ItemInput

type ItemInput struct {
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
}

ItemInput is the input structure for adding a todo item.

type Options

type Options struct {
	// Instructions overrides the default instructions provided to the agent.
	Instructions *string

	// SuppressTodoListMessage, when true, prevents injecting the current todo
	// list summary message on each invocation.
	SuppressTodoListMessage bool

	// TodoListMessageBuilder, if set, is used to format the todo list summary
	// message instead of the default formatter.
	TodoListMessageBuilder func([]Item) string
}

Options configures the todo provider.

type Provider

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

Provider is an agent context provider that manages todo items. Use New to create. Provider can be used directly in agent configuration.

func New

func New(opts *Options) *Provider

New creates a new todo provider with the given options. If opts is nil, defaults are used.

func (*Provider) GetAllItems

func (p *Provider) GetAllItems(opts ...agent.Option) []Item

GetAllItems returns all todo items from the session state.

func (*Provider) GetRemainingItems

func (p *Provider) GetRemainingItems(opts ...agent.Option) []Item

GetRemainingItems returns only the incomplete todo items from the session state.

func (*Provider) Invoked

func (p *Provider) Invoked(ctx context.Context, invoked agent.InvokedContext) error

Invoked implements agent.ContextProvider by delegating to the wrapped provider. The wrapped provider is configured without a Store, so this is a no-op on success.

func (*Provider) Invoking

func (p *Provider) Invoking(ctx context.Context, invoking agent.InvokingContext) ([]*message.Message, []agent.Option, error)

Invoking implements agent.ContextProvider by delegating to the wrapped provider, applying this provider's context/instructions to the invocation.

Jump to

Keyboard shortcuts

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