Text Deputy adds to a conversation that nobody typed
Source:R/run-instruction.R
ContentRunInstruction.RdSome user messages in an agent's conversation are written by Deputy, not
by a person: the instruction to answer without tools when a run wraps up,
a Stop hook's request to go on, and the like. Deputy sends them as
ContentRunInstruction values. The class extends
ellmer::ContentText, so every provider sends exactly the same text to
the model as for plain text, and recorded conversations replay it. A host
that shows a conversation can use the class to leave these messages out
of the person's own, or show them differently.
Usage
ContentRunInstruction(text = character(), kind = "wrap_up")Arguments
- text
The text the model reads.
- kind
What the instruction is for. Deputy uses:
"wrap_up": the instruction to answer now, without tools, after a limit orAgent$request_wrap_up()."background_tasks": the background tasks the model had not collected, given with that instruction."shortened_results": which large tool results were shortened for that answer."stop_hook": the message of aHookResultStop()that sends a run on."structured_correction": validation feedback asking for a corrected structured result."structured_extraction": the request for a structured result at the end of a task.
Other non-empty strings are accepted, so conversations saved by a later version still load.
Examples
instruction <- ContentRunInstruction(
"No more tools are available. Answer now.",
kind = "wrap_up"
)
S7::S7_inherits(instruction, ellmer::ContentText)
#> [1] TRUE
instruction@kind
#> [1] "wrap_up"