feat: integrate honcho-ai package and enhance tool progress callback in delegate_tool
This commit is contained in:
parent
72d3425eef
commit
1d7ce5e063
1 changed files with 22 additions and 0 deletions
|
|
@ -98,6 +98,27 @@ def _run_single_child(
|
||||||
|
|
||||||
child_prompt = _build_child_system_prompt(goal, context)
|
child_prompt = _build_child_system_prompt(goal, context)
|
||||||
|
|
||||||
|
# Build a progress callback that surfaces subagent tool activity.
|
||||||
|
# CLI: updates the parent's delegate spinner text.
|
||||||
|
# Gateway: forwards to the parent's progress callback (feeds message queue).
|
||||||
|
parent_progress_cb = getattr(parent_agent, 'tool_progress_callback', None)
|
||||||
|
def _child_progress(tool_name: str, preview: str = None):
|
||||||
|
tag = f"[subagent-{task_index+1}] {tool_name}"
|
||||||
|
# Update CLI spinner
|
||||||
|
spinner = getattr(parent_agent, '_delegate_spinner', None)
|
||||||
|
if spinner:
|
||||||
|
detail = f'"{preview}"' if preview else ""
|
||||||
|
try:
|
||||||
|
spinner.update_text(f"🔀 {tag} {detail}")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
# Forward to gateway progress queue
|
||||||
|
if parent_progress_cb:
|
||||||
|
try:
|
||||||
|
parent_progress_cb(tag, preview)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Extract parent's API key so subagents inherit auth (e.g. Nous Portal)
|
# Extract parent's API key so subagents inherit auth (e.g. Nous Portal)
|
||||||
parent_api_key = None
|
parent_api_key = None
|
||||||
|
|
@ -122,6 +143,7 @@ def _run_single_child(
|
||||||
providers_ignored=parent_agent.providers_ignored,
|
providers_ignored=parent_agent.providers_ignored,
|
||||||
providers_order=parent_agent.providers_order,
|
providers_order=parent_agent.providers_order,
|
||||||
provider_sort=parent_agent.provider_sort,
|
provider_sort=parent_agent.provider_sort,
|
||||||
|
tool_progress_callback=_child_progress,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set delegation depth so children can't spawn grandchildren
|
# Set delegation depth so children can't spawn grandchildren
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue