Skip to content

feat(adk-agent): standalone Google-ADK agent that listens + responds in the console#149

Open
ivanmkc wants to merge 1 commit into
masterfrom
feat/adk-listener-agent
Open

feat(adk-agent): standalone Google-ADK agent that listens + responds in the console#149
ivanmkc wants to merge 1 commit into
masterfrom
feat/adk-listener-agent

Conversation

@ivanmkc

@ivanmkc ivanmkc commented Jun 7, 2026

Copy link
Copy Markdown
Owner

What

Adds integrations/adk-agent/ — a standalone Python (Google ADK) agent that listens to one termchart viewer console scope and responds by rendering/updating the diagram AND posting a short text reply in the console log. It's an alternative to driving termchart from a coding harness (Claude Code / agy) via the CLI.

This is purely additive — nothing under packages/* changes. The agent speaks the existing viewer HTTP API (GET/POST /inbox, push/patch/suggest/status/focus).

How it works

human types in console ─▶ GET /inbox (long-poll) ─▶ ADK turn (Gemini)
                                                       │ render_diagram / patch_diagram
                                                       │ suggest_chips / set_status  ─▶ canvas
                                                       ▼
     incoming text reply ◀─ POST /inbox (message) ── the agent's final answer
  • Loop-back guard: the agent's replies land in the same inbox it polls, so it records each reply's seq and skips it on the next read (mirrors the browser console's seenSeqs) — it never answers itself.
  • CLI-parity resilience: long-poll from the cursor, back off 1s→2s→…→15s on transient errors (never exit), exit on a 4xx, forward-progress guard, clean SIGINT.
  • Real (non-peek) reads, so the human sees "Read by the agent ✓".
  • Vertex AI via ADC by default; the GCP project is read from env only, never hardcoded. Gemini-API-key fallback supported.
  • Scope discipline: acts only on its one configured project/agent.

Layout

config.py · models.py · client.py · prompts.py (compact, self-contained diagram cheat-sheet) · tools.py · agent.py · loop.py · main.py, plus pyproject.toml, README.md, .env.example, and a path-filtered CI workflow. Root README.md + AGENTS.md gained one-line pointers.

Verification

  • uv run pytest43 passed (hermetic: httpx.MockTransport + a scripted runner; no network, no LLM, no time.sleep).
  • uv run ruff check . clean · uv run mypy src clean.
  • ADK wiring verified against real google-adk 1.34.3 (caught + fixed App.name identifier requirement).
  • Real-viewer E2E: human message → read (acked=1) → flow rendered into the store → text reply posted into the console → PASS; no self-reply loop.
  • Config gate: exit 4 (no viewer) / exit 3 (missing scope).

The live Gemini-inference leg is for the maintainer to run (uv run termchart-adk with ADC) — it's environment/credential-dependent and intentionally not exercised in CI.

…in the console

Adds integrations/adk-agent/ — a standalone Python (Google ADK) agent that
long-polls one termchart viewer console scope and, on each human message,
renders/updates the diagram AND posts a short text reply into the log. An
alternative to driving termchart from a coding harness via the CLI.

- Speaks the existing viewer HTTP API only (no changes under packages/*):
  GET/POST /inbox, push/patch/suggest/status/focus.
- Loop-back guard: records the seq of each posted reply and skips it on read
  (mirrors the browser console's seenSeqs) so the agent never answers itself.
- CLI-parity resilience: long-poll from cursor, backoff 1s->15s on transient
  errors, exit on 4xx, forward-progress guard, clean SIGINT.
- Real (non-peek) reads, so the human sees "Read by the agent ✓".
- Vertex AI via ADC by default; GCP project read from env only, never hardcoded.
- Tests are hermetic (mocked HTTP + scripted runner; no network/LLM/sleep):
  43 passing, ruff + mypy clean. New path-filtered CI workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants