Skip to content

Commit 681d6a4

Browse files
feat(web-ui): agent creation studio (智能/自定义/模板/工作流) + codegen, preview, skills, AgentKit & A/B (#580)
Web UI "添加 Agent" flow and supporting backend: - Create modes: 智能模式 (conversational, backed by the dogfooding agent_builder that emits an agent-config JSON), 自定义 (scrollable form + scroll-spy rail: model config, built-in/custom/MCP tools, STM/LTM/KB backends, tracing exporters, sub-agents, Skill Hub picker), 从模板新建, 工作流. - Codegen: shared config -> runnable VeADK project (agent.py/__init__.py/ .env.example/requirements.txt) via create/codegen.ts + veadkCatalog.ts; both 智能/自定义 modes converge on it. Validated against the live runtime. - ProjectPreview: file tree + syntax-highlighted editor, ZIP export, and agent-structure YAML export/import. - Skill Hub integration (search + download + unzip into the project). - A/B compare: two builder apps (dogfooding + dogfooding_b) with selectable models, side-by-side preview, adopt-one. - Sidebar IA: single "添加 Agent" chooser (AgentKit / 从 0 快速创建); breadcrumb nav; remote AgentKit connections; agent search. - examples/dogfooding[_b] agent-builder examples; vite /skillhub proxy.
1 parent 611e1a9 commit 681d6a4

54 files changed

Lines changed: 11366 additions & 351 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/content/docs/framework/frontend/web-ui.en.mdx‎

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ description: "A bundled React UI that renders agent-streamed A2UI, served alongs
55

66
VeADK ships a React frontend that renders [A2UI](/en/docs/framework/frontend/a2ui) (agent-driven UI) streamed from an agent over the Google ADK API server. It talks to the same server process that `veadk frontend` launches, so there is **no separate backend to deploy**.
77

8+
## What it can do
9+
10+
- **Chat**: multi-turn conversations that render streamed A2UI cards, plus thinking, tool calls, token usage and timing.
11+
- **Agent picker**: switch agents from the top-left; hover an agent to see its model and mounted tools.
12+
- **Session history**: auto-saved, time-sorted, reopen or delete.
13+
- **Smart search**: the *Session* source full-text-searches the current agent's history; the *Web* source calls the agent's mounted web-search tool live (using credentials from the server's environment variables).
14+
- **Add an AgentKit agent**: paste a URL + API key to connect a remote agent over the ADK protocol; it then appears in the picker.
15+
- **Tracing**: view the call flame graph for the current session.
16+
- **Login**: SSO (VeIdentity / GitHub / Google / any OIDC) or a local username.
17+
818
## Run
919

1020
Build the UI once, then serve the UI and the agent API together with a single command:
@@ -39,7 +49,8 @@ cd frontend && npm run dev # http://localhost:5173 (proxies A
3949
| `--oauth2-user-pool` / `--oauth2-user-pool-client` | — | VeIdentity user pool / client **name**. Enables SSO when set. |
4050
| `--oauth2-user-pool-uid` / `--oauth2-user-pool-client-uid` | env `OAUTH2_USER_POOL_ID` / `OAUTH2_USER_POOL_CLIENT_ID` | Specify the pool / client by **UID** instead of name. |
4151
| `--oauth2-provider` / `--oauth2-provider-label` | `veidentity` | Login button provider id and display label. |
42-
| `--oauth2-redirect-uri` | `http://{host}:{port}/oauth2/callback` | OAuth2 callback URL. |
52+
| `--oauth2-redirect-uri` | `http://{host}:{port}/oauth2/callback` | OAuth2 callback URL (env `OAUTH2_REDIRECT_URI`). Set this when deploying behind a public host / runtime. |
53+
| Third-party / custom provider | see below | Connect GitHub / Google / any OIDC via env vars; see the Authentication section. |
4354

4455
<Callout type="info">
4556
Outside dev mode, if the built frontend directory is not found, the command fails and asks you to run `npm run build` first (or use `--dev` with the Vite dev server).
@@ -66,6 +77,43 @@ protects the API while exempting the SPA shell and `GET /web/auth-config`, so th
6677
app loads and shows its own login page instead of being bounced to the IdP. The
6778
login button's label/icon is config-driven (`--oauth2-provider` / `-label`).
6879

80+
**Third-party / custom OAuth2 (env vars)** — without a VeIdentity user pool, set
81+
`OAUTH2_CLIENT_ID` (and secret) to enable GitHub, Google, or any OAuth2/OIDC
82+
login. Endpoints are resolved in this order: a built-in preset
83+
(`OAUTH2_PROVIDER=github` / `google`) → OIDC discovery (set `OAUTH2_ISSUER`) →
84+
explicit endpoints (`OAUTH2_AUTHORIZE_URL`, etc.).
85+
86+
| Env var | Description |
87+
| :-- | :-- |
88+
| `OAUTH2_PROVIDER` | Provider id: `github`, `google`, or a custom name. Drives the login button label and the preset. |
89+
| `OAUTH2_CLIENT_ID` / `OAUTH2_CLIENT_SECRET` | OAuth2 client credentials. **Setting `OAUTH2_CLIENT_ID` enables the generic provider.** |
90+
| `OAUTH2_ISSUER` | OIDC issuer base URL; endpoints are auto-discovered (e.g. `https://accounts.google.com`). |
91+
| `OAUTH2_AUTHORIZE_URL` / `OAUTH2_TOKEN_URL` / `OAUTH2_USERINFO_URL` | Explicit endpoints (for non-OIDC providers). |
92+
| `OAUTH2_SCOPE` | Override the requested scopes. |
93+
| `OAUTH2_PROVIDER_LABEL` | Override the login button text. |
94+
| `OAUTH2_REDIRECT_URI` | **Callback URL.** Set this when deploying behind a public host / runtime, and register the same value in your OAuth app; defaults to `http://{host}:{port}/oauth2/callback` locally. |
95+
96+
GitHub (preset — only id/secret needed):
97+
98+
```bash
99+
export OAUTH2_PROVIDER=github
100+
export OAUTH2_CLIENT_ID=<github-oauth-client-id>
101+
export OAUTH2_CLIENT_SECRET=<github-oauth-client-secret>
102+
export OAUTH2_REDIRECT_URI=http://127.0.0.1:8000/oauth2/callback
103+
veadk frontend --agents-dir examples
104+
```
105+
106+
Google is the same with `OAUTH2_PROVIDER=google`; for any OIDC provider
107+
(Keycloak / Auth0 / Okta / …) set `OAUTH2_ISSUER` plus the client credentials. A
108+
full example lives at `examples/front_with_sso/`.
109+
110+
<Callout type="info">
111+
When deploying to a runtime / public host, the OAuth callback must point at an
112+
externally reachable URL: set `OAUTH2_REDIRECT_URI` to the public callback URL
113+
and register the same value in your OAuth app. The cookie `Secure` flag is
114+
enabled automatically when that URL is HTTPS.
115+
</Callout>
116+
69117
**No SSO (local username)** — without those flags, the login page asks for a
70118
username (letters + digits, ≤16), stored locally and used as the `user_id`.
71119

‎docs/content/docs/framework/frontend/web-ui.mdx‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ description: "内置 React 前端,用于渲染智能体流式返回的 A2UI,
55

66
VeADK 自带一个 React 前端,用于渲染智能体经由 Google ADK API Server 流式返回的 [A2UI](/cn/docs/framework/frontend/a2ui)(智能体驱动 UI)。它与 `veadk frontend` 启动的是同一个服务进程,因此**无需单独部署后端**。
77

8+
## 功能一览
9+
10+
- **对话**:与智能体多轮对话,渲染流式返回的 A2UI 卡片,并展示思考过程、工具调用、Token 与用时。
11+
- **Agent 选择器**:左上角切换 agent;悬停可查看该 agent 的模型与挂载的工具。
12+
- **历史会话**:自动保存、按时间排序,可重新打开或删除。
13+
- **智能搜索**:「会话」源在当前 agent 的历史消息中做全文检索;「网页」源调用该 agent 挂载的联网搜索工具实时检索(使用服务端环境变量里的凭据)。
14+
- **添加 AgentKit 智能体**:填入访问地址 + API Key,按 ADK 协议接入远程 agent,接入后出现在选择器中。
15+
- **Tracing 观测**:查看本次会话的调用火焰图。
16+
- **登录**:支持 SSO(VeIdentity / GitHub / Google / 任意 OIDC)或本地用户名。
17+
818
## 运行
919

1020
先构建前端,再用一条命令同时提供 UI 与智能体 API:
@@ -39,7 +49,8 @@ cd frontend && npm run dev # http://localhost:5173(代理 A
3949
| `--oauth2-user-pool` / `--oauth2-user-pool-client` | — | VeIdentity 用户池 / 客户端**名称**。设置后启用 SSO。 |
4050
| `--oauth2-user-pool-uid` / `--oauth2-user-pool-client-uid` | 环境变量 `OAUTH2_USER_POOL_ID` / `OAUTH2_USER_POOL_CLIENT_ID` | 用 **UID** 代替名称指定用户池 / 客户端。 |
4151
| `--oauth2-provider` / `--oauth2-provider-label` | `veidentity` | 登录按钮的 provider 标识与显示文案。 |
42-
| `--oauth2-redirect-uri` | `http://{host}:{port}/oauth2/callback` | OAuth2 回调地址。 |
52+
| `--oauth2-redirect-uri` | `http://{host}:{port}/oauth2/callback` | OAuth2 回调地址(环境变量 `OAUTH2_REDIRECT_URI`)。部署到公网 / runtime 时需设置。 |
53+
| 第三方 / 自定义 provider | 见下文 | 通过环境变量接入 GitHub / Google / 任意 OIDC,详见「认证」一节。 |
4354

4455
<Callout type="info">
4556
非开发模式下,若未找到已构建的前端目录,命令会报错提示先执行 `npm run build`(或改用 `--dev` 配合 Vite 开发服务器)。
@@ -60,6 +71,34 @@ veadk frontend --agents-dir examples \
6071

6172
需要进程能拿到火山引擎凭证(AK/SK)。中间件保护 API、放行 SPA 外壳与 `GET /web/auth-config`,因此应用能加载并展示自己的登录页(而不是被直接重定向到 IdP)。登录按钮的文案/图标由配置驱动(`--oauth2-provider` / `--oauth2-provider-label`)。
6273

74+
**第三方 / 自定义 OAuth2(环境变量)** —— 不依赖 VeIdentity 用户池时,只要设置 `OAUTH2_CLIENT_ID`(及密钥),即可接入 GitHub、Google 或任意 OAuth2/OIDC 登录。端点来源按以下顺序确定:内置预设(`OAUTH2_PROVIDER=github` / `google`)→ OIDC 自动发现(设置 `OAUTH2_ISSUER`)→ 显式端点(`OAUTH2_AUTHORIZE_URL` 等)。
75+
76+
| 环境变量 | 说明 |
77+
| :-- | :-- |
78+
| `OAUTH2_PROVIDER` | provider 标识:`github`、`google` 或自定义名。决定登录按钮文案与内置预设。 |
79+
| `OAUTH2_CLIENT_ID` / `OAUTH2_CLIENT_SECRET` | OAuth2 客户端凭据。**设置 `OAUTH2_CLIENT_ID` 即启用通用 provider。** |
80+
| `OAUTH2_ISSUER` | OIDC issuer 基址,端点自动发现(如 `https://accounts.google.com`)。 |
81+
| `OAUTH2_AUTHORIZE_URL` / `OAUTH2_TOKEN_URL` / `OAUTH2_USERINFO_URL` | 显式端点(用于非 OIDC provider)。 |
82+
| `OAUTH2_SCOPE` | 覆盖请求的 scope。 |
83+
| `OAUTH2_PROVIDER_LABEL` | 覆盖登录按钮文案。 |
84+
| `OAUTH2_REDIRECT_URI` | **回调地址**。部署到公网 / runtime 时设为公网回调,并在 OAuth 应用中登记同一地址;本地默认 `http://{host}:{port}/oauth2/callback`。 |
85+
86+
GitHub(预设,仅需 id/secret):
87+
88+
```bash
89+
export OAUTH2_PROVIDER=github
90+
export OAUTH2_CLIENT_ID=<github-oauth-client-id>
91+
export OAUTH2_CLIENT_SECRET=<github-oauth-client-secret>
92+
export OAUTH2_REDIRECT_URI=http://127.0.0.1:8000/oauth2/callback
93+
veadk frontend --agents-dir examples
94+
```
95+
96+
Google 同理,把 `OAUTH2_PROVIDER` 换成 `google`;Keycloak / Auth0 / Okta 等任意 OIDC 则设 `OAUTH2_ISSUER` + 客户端凭据即可。完整示例见仓库 `examples/front_with_sso/`。
97+
98+
<Callout type="info">
99+
部署到 runtime / 公网时,OAuth 回调必须指向外部可访问的地址:把 `OAUTH2_REDIRECT_URI` 设为公网回调 URL,并在 OAuth 应用里登记同一地址。Cookie 的 `Secure` 标志会根据该地址是否为 HTTPS 自动开启。
100+
</Callout>
101+
63102
**无 SSO(本地用户名)** —— 不传上述参数时,登录页会让用户输入一个用户名(字母 + 数字,≤16 位),保存在本地并作为 `user_id`。
64103

65104
<Callout type="info">

0 commit comments

Comments
 (0)