agent
Helpers for building user-facing agents. This module offers two independent tools:
questionasks the user something through an interrupt the host UI can render, andtodoWrite/todoListgive the LLM a small todo list to track multi-step work across turns.
Effects
std::question
effect std::question {
prompt: string
}(source)
Functions
todoAdd
todoAdd(todo: Todo): Todo[]Add a new todo to the list.
Parameters:
| Name | Type | Default |
|---|---|---|
| todo | Todo |
Returns: Todo[]
(source)
todoUpdate
todoUpdate(id: string, status: "pending" | "in_progress" | "completed"): Todo[]Update the status of a todo by id.
Parameters:
| Name | Type | Default |
|---|---|---|
| id | string | |
| status | "pending" | "in_progress" | "completed" |
Returns: Todo[]
(source)
todoWrite
todoWrite(todos: Todo[]): Todo[]Replace the current todo list.
Parameters:
| Name | Type | Default |
|---|---|---|
| todos | Todo[] |
Returns: Todo[]
(source)
todoList
todoList(): Todo[]Return the current todo list.
Returns: Todo[]
(source)
question
question(prompt: string): stringAsk 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:
| Name | Type | Default |
|---|---|---|
| prompt | string |
Returns: string
Throws: std::question
(source)