Campos
idstringGenerato per esta interrogazione.
questionstring- Cee que si chiede.
optionsarrayRisposte sugestive, quando offrise.
Necessà aQuestion
const agent = api.agents.create({
runtime: "local", machine: pc, model,
onQuestion: async ({ question, options }) => {
console.log(question, options);
return await readAnswerFromTheUser(); // a string
},
onEvent: (e) => {
if (e.type === "question") showQuestion(e.id, e.question, e.options);
if (e.type === "question_result") closeQuestion(e.id, e.answer);
},
});def on_question(request):
print(request["question"], request["options"])
return read_answer_from_the_user() # a string
agent = api.agents.create(runtime="local", machine=pc, model=model, on_question=on_question)L'utenda è solo cablada quando la chiamata è là. Un agente senza esso non ha modo di chiedere, ed è instruit a fare un appello di giudizio o explicar ce blocca in lugar — che è un run differente, non un block.
question_result
{ type: "question_result", id, answer } // "" when nothing was returned# The ask_user tool returns what on_question answered, or None when no callback is set
{"answer": "the second option"}Una risposta vazio è passè al agente come una risposta vazio; non è un erro, e il loop continua.
Quando il sollevi
- La richiesta è ambigua e la scelta è del user.
- Due tentazioni di la stessa approccio hanno fallit — si dice a chiedere plutôt que tentar un tercio.
Un subagente non chiede mai
ask_user è uno dei tre strumenti che un subagente non riceve. Si dice che non può parlare con l'usuario e deve informar in cambio — quindi una domanda sempre viene da la run principal, e non porta parentId.