TodoProvider class

An AIContextProvider that provides todo management tools and instructions to an agent for tracking work items during long-running complex tasks.

The TodoProvider enables agents to create, complete, remove, and query todo items as part of their planning and execution workflow. Todo state is stored in the session's state bag and persists across agent invocations within the same session. This provider exposes the following tools to the agent:

  • TodoList_Add — Add one or more todo items.
  • TodoList_Complete — Mark one or more todo items as complete by ID.
  • TodoList_Remove — Remove one or more todo items by ID.
  • TodoList_GetRemaining — Retrieve only incomplete todo items.
  • TodoList_GetAll — Retrieve all todo items (complete and incomplete).
Inheritance

Constructors

TodoProvider({TodoProviderOptions? options})
Creates a TodoProvider with optional options.

Properties

hashCode int
The hash code for this object.
no setterinherited
provideInputMessageFilter Iterable<ChatMessage> Function(Iterable<ChatMessage>)
Filter applied to input messages before providing context.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateKeys List<String>
The keys used to store provider state in the StateBag.
no setteroverride
storeInputRequestMessageFilter Iterable<ChatMessage> Function(Iterable<ChatMessage>)
Filter applied to request messages before storing context.
finalinherited
storeInputResponseMessageFilter Iterable<ChatMessage> Function(Iterable<ChatMessage>)
Filter applied to response messages before storing context.
finalinherited

Methods

createTools(AgentSession? session) List<AITool>
dispose() → void
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
getAllTodos(AgentSession? session) Future<List<TodoItem>>
Returns all todo items from the session state.
getRemainingTodos(AgentSession? session) Future<List<TodoItem>>
Returns the remaining (incomplete) todo items from the session state.
getService(Type serviceType, {Object? serviceKey}) Object?
Returns a service of the specified serviceType, or null.
inherited
getServiceOf<T extends Object>({Object? serviceKey}) → T?
Returns a service of type T, or null.
inherited
getSessionLock(AgentSession? session) → Pool
Returns the per-session pool used to serialize all todo operations.
invoked(InvokedContext context, {CancellationToken? cancellationToken}) Future<void>
Called at the end of the agent invocation to process results.
inherited
invokedCore(InvokedContext context, {CancellationToken? cancellationToken}) Future<void>
Core implementation of invoked. Skips processing on failure, applies message filters, then calls storeAIContext.
inherited
invoking(InvokingContext context, {CancellationToken? cancellationToken}) Future<AIContext>
Called at the start of agent invocation to provide additional context.
inherited
invokingCore(InvokingContext context, {CancellationToken? cancellationToken}) Future<AIContext>
Core implementation of invoking. Filters messages, calls provideAIContext, and merges the returned context with the input.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
provideAIContext(InvokingContext context, {CancellationToken? cancellationToken}) Future<AIContext>
When overridden in a derived class, provides additional AI context to be merged with the input context for the current invocation.
override
storeAIContext(InvokedContext context, {CancellationToken? cancellationToken}) Future<void>
When overridden in a derived class, processes invocation results.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

formatTodoListMessage(List<TodoItem> items) String

Constants

defaultInstructions → const String