Skip to content

feat(adk): add subagent middleware example with TUI#204

Open
hi-pender wants to merge 6 commits intomainfrom
feat/subagent-example
Open

feat(adk): add subagent middleware example with TUI#204
hi-pender wants to merge 6 commits intomainfrom
feat/subagent-example

Conversation

@hi-pender
Copy link
Copy Markdown
Contributor

Summary

  • Add adk/middlewares/subagent/ example demonstrating eino's subagent middleware (from feat/subagent branch)
  • Main ChatModelAgent with Explore and Plan read-only subagents running in background via TaskMgr
  • Dual-panel Bubbletea TUI: background SubAgent tasks on top, main agent REPL loop on bottom, both with scrollbars
  • Multi-turn conversation loop: after main agent turn completes, waits for subagent results and feeds them back for the next turn
  • Uses ArkModel with CozeLoop callback handler

Dependencies

  • Updates github.com/cloudwego/eino to feat/subagent branch (89b967b5)
  • Adds charmbracelet/bubbletea, charmbracelet/lipgloss, charmbracelet/bubbles, mattn/go-runewidth

Test plan

  • Set env vars: ARK_API_KEY, ARK_MODEL
  • Run: go run ./adk/middlewares/subagent/
  • Type a query triggering subagent use (e.g., "explore the project structure in this directory")
  • Verify: Main panel shows tool calls/results, SubAgent panel shows background task status and events
  • Verify: CJK characters display correctly without garbled text on wrap
  • Verify: After subagent completes, main agent automatically starts a new turn with results

🤖 Generated with Claude Code

hi-pender and others added 6 commits April 14, 2026 21:25
Add a demo application showcasing the subagent middleware from eino's
feat/subagent branch. The example creates a main ChatModelAgent with
Explore and Plan read-only subagents that run in background via TaskMgr,
displayed in a dual-panel Bubbletea TUI with scrollable views and
multi-turn conversation loop that feeds subagent results back into the
main agent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each subagent task now gets a dedicated tmux window with real-time event
streaming via FIFO pipes. The top panel becomes a compact task status bar
showing tmux jump hints (e.g., "tmux select-window -t :task_1"). Falls
back to the previous in-TUI event log when tmux is not available.

Three modes: inside tmux (uses current session), external (creates
eino-subagents session), none (graceful degradation to TUI panel).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Main agent now fills the entire window; subagent status shown as
  compact footer below the main panel (one line per task with tmux link)
- Replace FIFO-based tmux output with regular temp file + tail -f
  combined with stty -echo to prevent arrow key escape sequences
  from appearing as garbage characters in subagent windows
- Users can scroll tmux subagent windows via copy mode (Ctrl+B [)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ment

Set the prompt directly on textinput.Model instead of prepending
externally, which caused a duplicate ">" and misaligned placeholder
text rendering at line start instead of at the cursor position.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ndow hint

Replace stty -echo + tail -f with less -R +F which is a proper terminal
app that handles keyboard input correctly. Users get arrow key scrolling,
PgUp/PgDn, search with /, and can toggle follow mode with Ctrl+C / F.

Remove per-task tmux select-window hints (broken in external mode) and
show a single line with attach command and keyboard shortcuts instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cleanup now kills each tmux window and, in external mode, kills
the entire eino-subagents session. Previously only temp files were
removed, leaving orphaned tmux sessions after the process exited.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant