Documentation
¶
Overview ¶
Package ask is Lagrange's convention for questions an agent puts to a person: multiple-choice questions, like Claude Code's plan-mode questions (each has a few options to pick one or several of, and the person can write their own answer in clients that allow it), and approvals (a yes/no on what the message says).
Both travel in the message metadata, next to a plain text rendering, so a client that knows neither still shows something to answer:
- MetaKey holds the questions; the answer is a text message, one line per question (see Format).
- ApprovalKey (true) marks an approval; the answer is the decision "approve" or "reject" (POST /api/tasks/{id}/answer), which completes or rejects the task.
Clients with buttons (the web inbox, Telegram) render both as buttons.
Index ¶
Constants ¶
const ( // MetaKey is the message metadata key that carries the questions. MetaKey = "https://threeagents.dev/ext/questions" // LegacyMetaKey is the key Halo used before the questions moved to Lagrange; Parse // still reads it. LegacyMetaKey = "https://threeagents.dev/ext/halo/questions" // ApprovalKey marks a message that asks to approve or reject (metadata true). ApprovalKey = "https://threeagents.dev/ext/approval" )
const ( MaxQuestions = 4 MinOptions = 2 MaxOptions = 5 )
Limits keep a form small enough to answer at a glance.
Variables ¶
This section is empty.
Functions ¶
func ApprovalField ¶
func ApprovalField(schema *jsonschema.Schema) (string, bool)
ApprovalField returns the boolean field of a structured input form that a plain approve or reject can answer: the form has exactly one boolean field, and every other field is optional (an approval with an optional note).
func IsApproval ¶
IsApproval reports whether metadata marks an approval.
Types ¶
type Answer ¶
Answer is the human's answer to one question: the options picked (by index), and their own words, which may stand alone or add to the picks.
type Option ¶
type Option struct {
Label string `json:"label" jsonschema:"1-5 words; put the recommended option first and end its label with (Recommended)"`
Description string `json:"description,omitempty" jsonschema:"one sentence: what picking it means, its trade-off"`
}
Option is one answer to pick.
type Question ¶
type Question struct {
Header string `json:"header" jsonschema:"a 1-2 word tag for the question, like Auth or Scope"`
Question string `json:"question" jsonschema:"the whole question, ending with a question mark"`
Options []Option `json:"options" jsonschema:"2-5 distinct choices; the human can always write their own instead"`
MultiSelect bool `json:"multi_select,omitempty" jsonschema:"true when several options can apply together"`
}
Question is one question of a form.