ag-ui-protocol / ag-ui-protocol/ag-ui

Auto-discover AgentCapabilities from the wrapped ADK agent (opt-in)

Đang mở
#2,107 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement Integration
Ngôn ngữ chính
Python
Star
15.9k
Fork
1.4k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
163

Mô tả

## Feature request: auto-discover `AgentCapabilities` from the wrapped ADK agent

`ag-ui-adk` already exposes `GET /capabilities` (via `add_adk_fastapi_endpoint`) and `ADKAgent.get_capabilities()`, but today that only returns whatever dict the developer hand-wrote into the `capabilities=` constructor arg — otherwise `None`. The middleware **knows** a lot about the agent it wraps (name, description, sub-agents, planner, tools) yet derives nothing from it. So an agent that clearly supports multi-agent delegation, reasoning, and human-in-the-loop advertises `{}` unless the developer manually restates all of it — which is easy to forget and drifts out of sync with the actual agent.

### Proposal

Add an opt-in `discover_capabilities: bool = False` flag to `ADKAgent` / `ADKAgent.create(...)`. When enabled, `get_capabilities()` derives a best-effort `AgentCapabilities` by structurally inspecting the wrapped ADK agent (no run needed), then **merges it under** any explicitly-configured `capabilities` — the developer's explicit values always win (one level deep). Flag off → behavior is 100% unchanged (`None` or exactly the configured dict).

Mapping (all `getattr`-guarded so `SequentialAgent` / custom `BaseAgent` roots degrade gracefully):

| Derived key | Source on the ADK agent |
|---|---|
| `identity.{name,description}` + `identity.type: "google-adk"` | `agent.name`, `agent.description` |
| `multiAgent.{supported, subAgents[]}` | `agent.sub_agents` |
| `reasoning.{supported, streaming}` | planner with `thinking_config.include_thoughts` |
| `tools.supported` | non-empty `agent.tools` |
| `humanInTheLoop.supported` | an `AGUIToolset` present in `agent.tools` |
| `transport.streaming` | always `True` (middleware serves SSE) |

### Why

- **Zero-config discovery** — a frontend or agent marketplace can hit `GET /capabilities` and learn the agent is multi-agent / reasoning / HITL-capable without the developer hand-maintaining the dict.
- **No drift** — capabilities track the actual agent structure instead of a stale hand-written copy.
- **Fully backward compatible** — opt-in flag, explicit config still wins per sub-key.

Happy to submit the PR (implementation + tests are ready) — opening the issue first to confirm the derivation mapping (especially the `identity.type: "google-adk"` value and the "explicit-wins one-level-deep" merge semantics) matches what maintainers want.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.