This is an Agent-first orchestration loop. It observes tool_call_end events,
parses tool calls, invokes matching R tools with private context, appends
tool results to the agent transcript, and continues generation.
Arguments
- agent
A
BebelAgentobject.- tools
A list of
bebel_tool()objects or named functions.- context
Private run context passed to tools and hooks but not appended to the model transcript.
- hooks
Optional named list of hooks:
turn_start,event,tool_request,tool_result,tool_error,turn_end.- parse_tool_call
Function converting tool-call content to
list(name, arguments, raw).- max_steps
Maximum assistant/tool iterations.
- on_event
Optional event callback or handler list for model events.
- check_interrupt
Check for Ctrl-C during generation.