subagent_chat_activity() shows each tool call a subagent makes as a pair of
cards in the lead's conversation: a request and its result. Use this
function on the contents of lead$get_turns() to tell those cards apart
from the lead's own tool calls, for example to check an answer against what
the subagent's tools returned. Use lead$get_turns(activity = FALSE) to
leave the cards out instead.
Value
NULL unless content is a card shown by
subagent_chat_activity(). For a card, a list with:
activity_id: the card's ID, which its request and result share.root_tool_call_id: the ID of the lead's tool call that delegated the work, so you can find the delegation the card belongs to.label,agent_name,agent_id: which subagent made the call.depth: 1 for the lead's own subagents, 2 for theirs, and so on.sequence,delegation_id,parent_delegation_id,run_id: the call's position among the cards and the delegation it ran in.
Fields with no value are left out.
A result card for a call that never returned to the card, because its
subagent stopped, the reply ended, the conversation was saved or the
activity stopped being shown, is an error result whose
extra$deputy_interrupted is TRUE, so a host can show it as
interrupted rather than failed. So is the card for a call the subagent's
run refused without running it (as it wrapped up, say), or stopped
waiting for. The mark is kept out of extra$display, whose fields
shinychat checks.
Examples
subagent_activity_info(ellmer::ContentText("Not a card"))
#> NULL