[Feature request] New Agent (beta): composer UI to declare app variables so webapp URL pre-fill works like Chatflow's Hidden & Pre-Filled fields
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
### Self Checks
- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] Please do not modify this template :) and fill in all the required fields.
### 1. Is this request related to a challenge you're experiencing? Tell me about your story.
We publish an internal assistant as a **standalone new Agent app** (mode `agent`, beta) on self-hosted **1.17.0**, and external systems (intranet portals) need to hand off context (e.g. expense report id, user identity) into the published webapp URL.
On **Chatflow** apps this is a first-class flow: mark User Input fields as **Hidden & Pre-Filled**, then share `{WEBAPP_URL}?{VAR}={VALUE}` — the official docs even describe generating such links in bulk from a third-party system.
On a standalone Agent app I could not find any way to declare input variables. I was trying to pre-fill variables via `/agent/?var=value`, and nothing happened: `GET /parameters` returns an empty `user_input_form`, the opening form never renders, and the URL params are silently dropped by the backend whitelist filter (`api/core/app/apps/base_app_generator.py:124-137`). It's frustrating because **everything downstream of the config already works** — only the declaration UI is missing.
### 2. Additional context or comments
Source findings on 1.17.0 (the plumbing is already in place):
- Contract exists: `AppVariableConfig { name, type, required, default }` — `packages/contracts/generated/api/console/agent/types.gen.ts:1016-1021`, referenced as `app_variables` on the Agent Soul config (`:584`).
- Runtime projection exists: Agent Soul `app_variables` → `user_input_form` — `api/core/app/apps/agent_app/app_config_manager.py:113` (served by `GET /parameters`).
- Webapp rendering exists, with **no agent-specific gating**: plain-text URL query params are consumed at `web/app/components/base/chat/chat-with-history/hooks.tsx:331-339` (`getRawInputsFromUrlParams`); the opening form renders whenever `user_input_form` is non-empty (`chat-wrapper.tsx:349-358`); values are submitted as `inputs` with `POST /chat-messages`.
- The console **preview adapter already maps** `app_variables` to input-form types — `web/features/agent-v2/agent-detail/configure/components/preview/chat-config.ts:100-107,123-124,206-215`.
- The missing piece: `web/features/agent-v2/agent-composer/store-modules/` has no app-variables module (only app-features/env/files/knowledge/model/prompt/skills/tools), so `app_variables` can currently only be set via DSL import / console API.
**Suggested solution:** add an "App variables" section to the Agent composer — types text-input / paragraph / select / number / json (same mapping the preview adapter already uses), plus a per-field "hidden & pre-filled" toggle — persisted to Agent Soul `app_variables`. That alone unlocks URL query pre-fill on `/agent/[token]` webapps with no further changes.
Related: #41779 (binding declared variables to tool parameters).
### 3. Can you help us with this feature?
- [ ] I am interested in contributing to this feature.
Contributor guide
Research direction
Start in web/features/agent-v2/agent-composer/store-modules/ and compare the existing modules with the preview mapping in web/features/agent-v2/agent-detail/configure/components/preview/chat-config.ts. Then trace Agent Soul app_variables through api/core/app/apps/agent_app/app_config_manager.py and GET /parameters. Done means the composer declares and persists the supported variables and the agent webapp receives declared URL values in its opening form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- api, backend, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 66/100