|
| 1 | +# Agent UI Config |
| 2 | + |
| 3 | +The Agent UI Configuration API allows you to customize the Agent web interface appearance, layout, and behavior. Configure branding, welcome screens, navigation, and GUI Agent display options. |
| 4 | + |
| 5 | +## Configuration Methods |
| 6 | + |
| 7 | +### Via tarko.config.ts |
| 8 | + |
| 9 | +Configure Web UI through the `webui` option in your `tarko.config.ts`: |
| 10 | + |
| 11 | +```typescript |
| 12 | +// tarko.config.ts |
| 13 | +import { AgentAppConfig } from '@tarko/interface' |
| 14 | + |
| 15 | +export default { |
| 16 | + // ... other config |
| 17 | + webui: { |
| 18 | + logo: 'https://example.com/logo.png', |
| 19 | + title: 'My Agent', |
| 20 | + subtitle: 'AI Assistant for Development', |
| 21 | + welcomTitle: 'Welcome to My Agent', |
| 22 | + welcomePrompts: [ |
| 23 | + 'Search for the latest GUI Agent papers', |
| 24 | + 'Find information about UI TARS' |
| 25 | + ] |
| 26 | + } |
| 27 | +} as AgentAppConfig |
| 28 | +``` |
| 29 | + |
| 30 | +### Via Agent Constructor |
| 31 | + |
| 32 | +Set Agent UI Configuration through the static `webuiConfig` property: |
| 33 | + |
| 34 | +```typescript |
| 35 | +// Agent class |
| 36 | +import { AgentWebUIImplementation } from '@tarko/interface' |
| 37 | + |
| 38 | +export class MyAgent extends MCPAgent { |
| 39 | + static webuiConfig: AgentWebUIImplementation = { |
| 40 | + logo: 'https://example.com/logo.png', |
| 41 | + title: 'My Agent', |
| 42 | + workspace: { |
| 43 | + navItems: [ |
| 44 | + { |
| 45 | + title: 'Code Editor', |
| 46 | + link: 'http://localhost:3000', |
| 47 | + icon: 'code' |
| 48 | + } |
| 49 | + ] |
| 50 | + } |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +## Configuration Options |
| 56 | + |
| 57 | +### Basic Branding |
| 58 | + |
| 59 | +#### logo |
| 60 | + |
| 61 | +```typescript |
| 62 | +logo?: string |
| 63 | +``` |
| 64 | + |
| 65 | +Web UI logo URL. Displayed in the navigation bar. |
| 66 | + |
| 67 | +**Default:** Tarko logo |
| 68 | + |
| 69 | +#### title |
| 70 | + |
| 71 | +```typescript |
| 72 | +title?: string |
| 73 | +``` |
| 74 | + |
| 75 | +Site title displayed in navbar and browser tab. |
| 76 | + |
| 77 | +**Default:** Agent name |
| 78 | + |
| 79 | +#### subtitle |
| 80 | + |
| 81 | +```typescript |
| 82 | +subtitle?: string |
| 83 | +``` |
| 84 | + |
| 85 | +Subtitle for home page and SEO meta description. |
| 86 | + |
| 87 | +#### welcomTitle |
| 88 | + |
| 89 | +```typescript |
| 90 | +welcomTitle?: string |
| 91 | +``` |
| 92 | + |
| 93 | +Hero title displayed on the home page welcome screen. |
| 94 | + |
| 95 | +### Welcome Screen |
| 96 | + |
| 97 | +#### welcomePrompts |
| 98 | + |
| 99 | +```typescript |
| 100 | +welcomePrompts?: string[] |
| 101 | +``` |
| 102 | + |
| 103 | +Array of suggested prompts displayed on the welcome screen. |
| 104 | + |
| 105 | +**Example:** |
| 106 | +```typescript |
| 107 | +welcomePrompts: [ |
| 108 | + 'Search for the latest GUI Agent papers', |
| 109 | + 'Find information about UI TARS', |
| 110 | + 'Tell me the top 5 most popular projects on ProductHunt today' |
| 111 | +] |
| 112 | +``` |
| 113 | + |
| 114 | +#### welcomeCards |
| 115 | + |
| 116 | +```typescript |
| 117 | +welcomeCards?: WelcomeCard[] |
| 118 | +``` |
| 119 | + |
| 120 | +Welcome screen cards with predefined prompts and Agent options. |
| 121 | + |
| 122 | +**WelcomeCard Interface:** |
| 123 | +```typescript |
| 124 | +interface WelcomeCard { |
| 125 | + title: string // Card display title |
| 126 | + prompt: string // Prompt content |
| 127 | + image?: string // Background image URL |
| 128 | + category: string // Grouping category |
| 129 | + agentOptions?: Record<string, any> // Agent configuration |
| 130 | +} |
| 131 | +``` |
| 132 | + |
| 133 | +**Example:** |
| 134 | +```typescript |
| 135 | +welcomeCards: [ |
| 136 | + { |
| 137 | + title: 'Code Review', |
| 138 | + prompt: 'Review my latest pull request', |
| 139 | + category: 'Development', |
| 140 | + image: 'https://images.unsplash.com/photo-1551288049-bebda4e38f71', |
| 141 | + agentOptions: { mode: 'review' } |
| 142 | + } |
| 143 | +] |
| 144 | +``` |
| 145 | + |
| 146 | +### Workspace Configuration |
| 147 | + |
| 148 | +#### workspace |
| 149 | + |
| 150 | +```typescript |
| 151 | +workspace?: { |
| 152 | + navItems?: WorkspaceNavItem[] |
| 153 | +} |
| 154 | +``` |
| 155 | + |
| 156 | +Workspace header navigation configuration. |
| 157 | + |
| 158 | +**WorkspaceNavItem Interface:** |
| 159 | +```typescript |
| 160 | +interface WorkspaceNavItem { |
| 161 | + title: string // Display text |
| 162 | + link: string // URL to open in new tab |
| 163 | + icon?: WorkspaceNavItemIcon // Icon type |
| 164 | +} |
| 165 | + |
| 166 | +type WorkspaceNavItemIcon = 'code' | 'monitor' | 'terminal' | 'browser' | 'desktop' | 'default' |
| 167 | +``` |
| 168 | +
|
| 169 | +**Example:** |
| 170 | +```typescript |
| 171 | +workspace: { |
| 172 | + navItems: [ |
| 173 | + { |
| 174 | + title: 'Code Server', |
| 175 | + link: 'http://localhost:8080', |
| 176 | + icon: 'code' |
| 177 | + }, |
| 178 | + { |
| 179 | + title: 'VNC', |
| 180 | + link: 'http://localhost:6080', |
| 181 | + icon: 'monitor' |
| 182 | + } |
| 183 | + ] |
| 184 | +} |
| 185 | +``` |
| 186 | +
|
| 187 | +### Layout Configuration |
| 188 | +
|
| 189 | +#### layout |
| 190 | +
|
| 191 | +```typescript |
| 192 | +layout?: { |
| 193 | + defaultLayout?: LayoutMode |
| 194 | + enableLayoutSwitchButton?: boolean |
| 195 | + enableSidebar?: boolean |
| 196 | + enableHome?: boolean |
| 197 | +} |
| 198 | +``` |
| 199 | +
|
| 200 | +Layout behavior and display options. |
| 201 | +
|
| 202 | +**LayoutMode:** |
| 203 | +```typescript |
| 204 | +type LayoutMode = 'default' | 'narrow-chat' |
| 205 | +``` |
| 206 | +
|
| 207 | +**Properties:** |
| 208 | +- `defaultLayout` - Initial layout mode (default: `'default'`) |
| 209 | + - `default` - Standard layout with full workspace |
| 210 | + - `narrow-chat` - Compact chat-focused layout |
| 211 | +- `enableLayoutSwitchButton` - Show layout toggle in toolbar (default: `false`) |
| 212 | +- `enableSidebar` - Display sidebar panel (default: `true`) |
| 213 | +- `enableHome` - Register home route (default: `true`) |
| 214 | +
|
| 215 | +**Example:** |
| 216 | +```typescript |
| 217 | +layout: { |
| 218 | + defaultLayout: 'narrow-chat', |
| 219 | + enableLayoutSwitchButton: true, |
| 220 | + enableSidebar: true |
| 221 | +} |
| 222 | +``` |
| 223 | +
|
| 224 | +### GUI Agent Configuration |
| 225 | +
|
| 226 | +#### guiAgent |
| 227 | +
|
| 228 | +```typescript |
| 229 | +guiAgent?: { |
| 230 | + defaultScreenshotRenderStrategy?: 'both' | 'beforeAction' | 'afterAction' |
| 231 | + enableScreenshotRenderStrategySwitch?: boolean |
| 232 | + renderGUIAction?: boolean |
| 233 | + renderBrowserShell?: boolean |
| 234 | +} |
| 235 | +``` |
| 236 | +
|
| 237 | +GUI Agent display and screenshot rendering options. |
| 238 | +
|
| 239 | +**Properties:** |
| 240 | +- `defaultScreenshotRenderStrategy` - Screenshot display strategy (default: `'afterAction'`) |
| 241 | + - `both` - Show before and after screenshots for comparison |
| 242 | + - `beforeAction` - Show only pre-action screenshots (suitable for Agent-TARS) |
| 243 | + - `afterAction` - Show only post-action screenshots (suitable for Omni-TARS) |
| 244 | +- `enableScreenshotRenderStrategySwitch` - Allow runtime strategy switching (default: `false`) |
| 245 | +- `renderGUIAction` - Show GUI operation details card (default: `true`) |
| 246 | +- `renderBrowserShell` - Wrap screenshots in browser shell UI (default: `true`) |
| 247 | +
|
| 248 | +**Example:** |
| 249 | +```typescript |
| 250 | +guiAgent: { |
| 251 | + defaultScreenshotRenderStrategy: 'beforeAction', |
| 252 | + enableScreenshotRenderStrategySwitch: true, |
| 253 | + renderGUIAction: true, |
| 254 | + renderBrowserShell: false |
| 255 | +} |
| 256 | +``` |
| 257 | +
|
| 258 | +### Advanced Options |
| 259 | +
|
| 260 | +#### enableContextualSelector |
| 261 | +
|
| 262 | +```typescript |
| 263 | +enableContextualSelector?: boolean |
| 264 | +``` |
| 265 | +
|
| 266 | +Enable @ syntax file selector. When enabled, users can type @ in the input to search and select workspace files/directories. |
| 267 | +
|
| 268 | +**Default:** `false` |
| 269 | +
|
| 270 | +#### base |
| 271 | +
|
| 272 | +```typescript |
| 273 | +base?: string |
| 274 | +``` |
| 275 | +
|
| 276 | +Base path for routing deployment. Supports both static paths and regex patterns. |
| 277 | +
|
| 278 | +**Examples:** |
| 279 | +```typescript |
| 280 | +base: "/agent-ui" // Static path |
| 281 | +base: "/tenant-.+" // Regex pattern |
| 282 | +base: "/(foo|bar)/app" // Regex with groups |
| 283 | +``` |
0 commit comments