Skip to content

agent ​

Helpers for building user-facing agents. This module offers two independent tools:

  • question asks the user something through an interrupt the host UI can render, and
  • todoWrite / todoList give the LLM a small todo list to track multi-step work across turns.

Effects ​

std::question ​

ts
effect std::question {
  prompt: string
}

(source)

Functions ​

todoAdd ​

ts
todoAdd(todo: Todo): Todo[]

Add a new todo to the list.

Parameters:

NameTypeDefault
todoTodo

Returns: Todo[]

(source)

todoUpdate ​

ts
todoUpdate(id: string, status: "pending" | "in_progress" | "completed"): Todo[]

Update the status of a todo by id.

Parameters:

NameTypeDefault
idstring
status"pending" | "in_progress" | "completed"

Returns: Todo[]

(source)

todoWrite ​

ts
todoWrite(todos: Todo[]): Todo[]

Replace the current todo list.

Parameters:

NameTypeDefault
todosTodo[]

Returns: Todo[]

(source)

todoList ​

ts
todoList(): Todo[]

Return the current todo list.

Returns: Todo[]

(source)

question ​

ts
question(prompt: string): string

Ask the user a question and wait for their reply. Use it when the work depends on a fact only the user knows, such as which address, account, or service they mean. Do not use it for something you can look up, and do not guess at a fact you could ask for.

@param prompt - The question to show the user

Alternative to the input function, raises an interrupt instead, so it can be used anywhere (eg a web server) instead of just the CLI.

Parameters:

NameTypeDefault
promptstring

Returns: string

Throws: std::question

(source)