@app-studio/web 0.9.41 → 0.9.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bot/Bot.d.ts +15 -0
- package/dist/bot/Cache.d.ts +13 -0
- package/dist/bot/Config.d.ts +13 -0
- package/dist/bot/ContentFetcher.d.ts +9 -0
- package/dist/bot/DocuCode.d.ts +19 -0
- package/dist/bot/FileHandler.d.ts +39 -0
- package/dist/bot/ai/AnthropicConnector.d.ts +6 -0
- package/dist/bot/ai/GeminiConnector.d.ts +7 -0
- package/dist/bot/ai/GroqConnector.d.ts +7 -0
- package/dist/bot/ai/HuggingFaceConnector.d.ts +6 -0
- package/dist/bot/ai/OpenAIConnector.d.ts +11 -0
- package/dist/bot/ai/ReplicateConnector.d.ts +7 -0
- package/dist/bot/ai/SambaNovaConnector.d.ts +6 -0
- package/dist/bot/ai/ai.config.d.ts +12 -0
- package/dist/bot/ai/ai.service.d.ts +36 -0
- package/dist/bot/data.d.ts +19 -0
- package/dist/bot/extractors.d.ts +8 -0
- package/dist/bot/index.d.ts +1 -0
- package/dist/bot/prompt/1-project.d.ts +1 -0
- package/dist/bot/prompt/2-response.d.ts +1 -0
- package/dist/bot/prompt/3-comment.d.ts +1 -0
- package/docs/components/Accordion.mdx +74 -121
- package/docs/components/Alert.mdx +19 -70
- package/docs/components/AspectRatio.mdx +13 -11
- package/docs/components/AudioInput.mdx +43 -0
- package/docs/components/Avatar.mdx +18 -43
- package/docs/components/Background.mdx +100 -492
- package/docs/components/Badge.mdx +45 -130
- package/docs/components/Button.mdx +76 -128
- package/docs/components/Calendar.mdx +7 -7
- package/docs/components/Card.mdx +247 -290
- package/docs/components/Carousel.mdx +94 -321
- package/docs/components/Chart.mdx +171 -26
- package/docs/components/ChatInput.mdx +327 -275
- package/docs/components/Checkbox.mdx +3 -5
- package/docs/components/ColorInput.mdx +6 -6
- package/docs/components/ColorPicker.mdx +452 -0
- package/docs/components/ComboBox.mdx +13 -13
- package/docs/components/Command.mdx +140 -188
- package/docs/components/ContextMenu.mdx +47 -171
- package/docs/components/CookieConsent.mdx +53 -0
- package/docs/components/CountryPicker.mdx +8 -8
- package/docs/components/DatePicker.mdx +3 -3
- package/docs/components/DragAndDrop.mdx +279 -463
- package/docs/components/Drawer.mdx +392 -231
- package/docs/components/DropdownMenu.mdx +37 -155
- package/docs/components/EmojiPicker.mdx +84 -0
- package/docs/components/File.mdx +130 -4
- package/docs/components/Formik.mdx +39 -39
- package/docs/components/Gradient.mdx +359 -182
- package/docs/components/Horizontal.mdx +1 -2
- package/docs/components/HoverCard.mdx +57 -125
- package/docs/components/KanbanBoard.mdx +9 -9
- package/docs/components/Link.mdx +22 -30
- package/docs/components/Loader.mdx +230 -413
- package/docs/components/Menubar.mdx +73 -69
- package/docs/components/Message.mdx +210 -525
- package/docs/components/Modal.mdx +351 -475
- package/docs/components/NavigationMenu.mdx +8 -8
- package/docs/components/OTPInput.mdx +194 -0
- package/docs/components/Pagination.mdx +451 -107
- package/docs/components/Password.mdx +8 -8
- package/docs/components/ProgressBar.mdx +460 -0
- package/docs/components/Resizable.mdx +103 -102
- package/docs/components/Select.mdx +5 -5
- package/docs/components/Separator.mdx +11 -98
- package/docs/components/ShareButton.mdx +29 -0
- package/docs/components/Sidebar.mdx +70 -131
- package/docs/components/Slider.mdx +99 -185
- package/docs/components/StatusIndicator.mdx +373 -0
- package/docs/components/Switch.mdx +3 -3
- package/docs/components/Table.mdx +25 -105
- package/docs/components/Tabs.mdx +40 -143
- package/docs/components/TagInput.mdx +17 -17
- package/docs/components/Text.mdx +3 -3
- package/docs/components/TextArea.mdx +6 -6
- package/docs/components/TextField.mdx +12 -12
- package/docs/components/Title.mdx +267 -525
- package/docs/components/Toast.mdx +65 -142
- package/docs/components/Toggle.mdx +37 -49
- package/docs/components/ToggleGroup.mdx +36 -57
- package/docs/components/Tooltip.mdx +501 -138
- package/docs/components/Uploader.mdx +205 -351
- package/package.json +1 -1
- package/dist/components/AuthGuard/AuthGuard.d.ts +0 -35
- package/dist/components/AuthGuard/index.d.ts +0 -1
- package/docs/adk-components.md +0 -319
- package/docs/adk-quick-start.md +0 -268
package/docs/adk-components.md
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
# ADK Agent Components
|
|
2
|
-
|
|
3
|
-
This document provides an overview of the React components created for compatibility with the ADK (Agent Development Kit) system.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The ADK Agent Components are a collection of React components designed to work seamlessly with ADK agents. These components are self-contained, handling their own state and API communications, providing a complete interface for agent interaction, session management, and more.
|
|
8
|
-
|
|
9
|
-
## Components
|
|
10
|
-
|
|
11
|
-
### 1. AgentChat Component
|
|
12
|
-
|
|
13
|
-
**Location**: `src/components/adk/AgentChat/`
|
|
14
|
-
|
|
15
|
-
A comprehensive chat interface for interacting with ADK agents.
|
|
16
|
-
|
|
17
|
-
#### Key Features:
|
|
18
|
-
- ✅ Real-time messaging via Server-Sent Events (SSE)
|
|
19
|
-
- ✅ File upload support (images, videos, audio, documents)
|
|
20
|
-
- ✅ Audio recording with live waveform visualization
|
|
21
|
-
- ✅ Function call visualization and execution
|
|
22
|
-
- ✅ Code execution and result display
|
|
23
|
-
- ✅ Agent thought process visualization
|
|
24
|
-
- ✅ Evaluation and scoring support
|
|
25
|
-
- ✅ Streaming and non-streaming responses
|
|
26
|
-
- ✅ Fully customizable styling and theming
|
|
27
|
-
- ✅ Accessibility-first design
|
|
28
|
-
|
|
29
|
-
#### Usage:
|
|
30
|
-
```tsx
|
|
31
|
-
import { AgentChat } from '@app-studio/web';
|
|
32
|
-
|
|
33
|
-
<AgentChat
|
|
34
|
-
appName="my-agent"
|
|
35
|
-
userId="user123"
|
|
36
|
-
apiBaseUrl="https://your-adk-api.com"
|
|
37
|
-
enableFileUpload={true}
|
|
38
|
-
enableAudioRecording={true}
|
|
39
|
-
enableStreaming={true}
|
|
40
|
-
enableThoughts={true}
|
|
41
|
-
onSessionCreate={(session) => console.log('Session created:', session)}
|
|
42
|
-
onMessageSent={(message) => console.log('Message sent:', message)}
|
|
43
|
-
/>
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
#### Props:
|
|
47
|
-
- `appName` (required): Name of the ADK agent application.
|
|
48
|
-
- `userId` (required): Unique identifier for the user.
|
|
49
|
-
- `sessionId`: Existing session ID to resume.
|
|
50
|
-
- `apiBaseUrl`: Base URL for ADK API endpoints.
|
|
51
|
-
- `enableFileUpload`: Enable file attachment functionality.
|
|
52
|
-
- `enableAudioRecording`: Enable audio recording from the microphone.
|
|
53
|
-
- `enableStreaming`: Enable real-time streaming responses.
|
|
54
|
-
- `enableThoughts`: Show agent thought processes.
|
|
55
|
-
- `views`: Custom styling options.
|
|
56
|
-
|
|
57
|
-
### 2. AgentSession Component
|
|
58
|
-
|
|
59
|
-
**Location**: `src/components/adk/AgentSession/`
|
|
60
|
-
|
|
61
|
-
A comprehensive session management component for ADK agents.
|
|
62
|
-
|
|
63
|
-
#### Key Features:
|
|
64
|
-
- ✅ Session creation, listing, and selection
|
|
65
|
-
- ✅ Session deletion and management
|
|
66
|
-
- ✅ Import/export functionality
|
|
67
|
-
- ✅ Search and filtering capabilities
|
|
68
|
-
- ✅ Auto-refresh and real-time updates
|
|
69
|
-
- ✅ Session metadata and tagging
|
|
70
|
-
- ✅ Compact and full display modes
|
|
71
|
-
- ✅ Bulk operations support
|
|
72
|
-
|
|
73
|
-
#### Usage:
|
|
74
|
-
```tsx
|
|
75
|
-
import { AgentSession } from '@app-studio/web';
|
|
76
|
-
|
|
77
|
-
<AgentSession
|
|
78
|
-
appName="my-agent"
|
|
79
|
-
userId="user123"
|
|
80
|
-
apiBaseUrl="https://your-adk-api.com"
|
|
81
|
-
showSessionHistory={true}
|
|
82
|
-
enableSessionImport={true}
|
|
83
|
-
enableSessionExport={true}
|
|
84
|
-
onSessionSelect={(session) => console.log('Selected:', session)}
|
|
85
|
-
onSessionCreate={(session) => console.log('Created:', session)}
|
|
86
|
-
/>
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
#### Props:
|
|
90
|
-
- `appName` (required): Name of the ADK agent application.
|
|
91
|
-
- `userId` (required): Unique identifier for the user.
|
|
92
|
-
- `apiBaseUrl`: Base URL for ADK API endpoints.
|
|
93
|
-
- `showSessionHistory`: Show session history list.
|
|
94
|
-
- `enableSessionImport`: Enable session import from JSON.
|
|
95
|
-
- `enableSessionExport`: Enable session export to JSON.
|
|
96
|
-
- `enableSessionSearch`: Enable search functionality.
|
|
97
|
-
- `maxSessions`: Maximum number of sessions to display.
|
|
98
|
-
- `views`: Custom styling options.
|
|
99
|
-
|
|
100
|
-
## Architecture
|
|
101
|
-
|
|
102
|
-
### Component Structure
|
|
103
|
-
|
|
104
|
-
Each component follows the established app-studio pattern:
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
ComponentName/
|
|
108
|
-
├── ComponentName.tsx # Main component file
|
|
109
|
-
├── ComponentName/ # Inner folder for core files
|
|
110
|
-
│ ├── ComponentName.props.ts # Props interface definitions
|
|
111
|
-
│ ├── ComponentName.state.ts # Custom state hook
|
|
112
|
-
│ ├── ComponentName.view.tsx # Presentational component
|
|
113
|
-
│ ├── ComponentName.style.ts # Style constants
|
|
114
|
-
│ └── [SupportingComponents].tsx # Additional components
|
|
115
|
-
└── examples/ # Usage examples
|
|
116
|
-
└── default.tsx # Default usage examples
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### ADK Integration
|
|
120
|
-
|
|
121
|
-
The components are self-contained and integrate directly with an ADK backend using `fetch`. You can specify the backend URL via the `apiBaseUrl` prop.
|
|
122
|
-
|
|
123
|
-
#### Required Backend Endpoints:
|
|
124
|
-
- `POST /sessions` - Create new agent session
|
|
125
|
-
- `POST /run_sse` - Send message with streaming response
|
|
126
|
-
- `POST /run` - Send message with regular response
|
|
127
|
-
- `GET /sessions/:id` - Get session details
|
|
128
|
-
- `DELETE /sessions/:id` - Delete session
|
|
129
|
-
- `POST /sessions/import` - Import session
|
|
130
|
-
|
|
131
|
-
#### Message Format:
|
|
132
|
-
The components use the same message format as the original ADK system:
|
|
133
|
-
|
|
134
|
-
```typescript
|
|
135
|
-
interface AgentRunRequest {
|
|
136
|
-
appName: string;
|
|
137
|
-
userId: string;
|
|
138
|
-
sessionId: string;
|
|
139
|
-
newMessage: {
|
|
140
|
-
role: string;
|
|
141
|
-
parts: MessagePart[];
|
|
142
|
-
};
|
|
143
|
-
streaming?: boolean;
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Direct API Interaction (`useAdk` Hook)
|
|
148
|
-
For developers who need to interact with the ADK API without using the pre-built UI components, a `useAdk` hook is available. This hook provides functions for all core ADK operations like creating sessions, running agents, and managing responses.
|
|
149
|
-
|
|
150
|
-
**Location**: `src/components/adk/useAdk.ts`
|
|
151
|
-
|
|
152
|
-
```tsx
|
|
153
|
-
import { useAdk } from '@app-studio/web';
|
|
154
|
-
|
|
155
|
-
const { createSession, runAgent, sessions, isLoadingSessions } = useAdk();
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### Design System Compliance
|
|
159
|
-
|
|
160
|
-
All components follow the app-studio design system:
|
|
161
|
-
|
|
162
|
-
- **Typography**: Inter/Geist font family with standardized sizes (xs:10, sm:12, md:14, lg:16, xl:20)
|
|
163
|
-
- **Spacing**: 4px grid system for consistent spacing
|
|
164
|
-
- **Colors**: app-studio color system (color.[color].[number]) instead of hardcoded values
|
|
165
|
-
- **Shapes**: Consistent border radius and rounded corners
|
|
166
|
-
- **Animations**: Using app-studio Animation object with proper duration and timing
|
|
167
|
-
|
|
168
|
-
### Reusability
|
|
169
|
-
|
|
170
|
-
The components are designed to be:
|
|
171
|
-
|
|
172
|
-
- **Modular**: Each component can be used independently
|
|
173
|
-
- **Customizable**: Extensive styling options via the `views` prop
|
|
174
|
-
- **Accessible**: ARIA labels, keyboard navigation, and screen reader support
|
|
175
|
-
- **Responsive**: Works across mobile, tablet, and desktop breakpoints
|
|
176
|
-
- **Themeable**: Support for light/dark themes and custom color schemes
|
|
177
|
-
|
|
178
|
-
## Examples and Documentation
|
|
179
|
-
|
|
180
|
-
### Demo Pages
|
|
181
|
-
|
|
182
|
-
- **AgentChat Demo**: `src/pages/agentChat.page.tsx`
|
|
183
|
-
- **Component Examples**: Available in each component's `examples/` directory
|
|
184
|
-
|
|
185
|
-
### Usage Examples
|
|
186
|
-
|
|
187
|
-
Each component includes multiple usage examples:
|
|
188
|
-
|
|
189
|
-
1. **Default Usage**: Basic implementation with minimal configuration
|
|
190
|
-
2. **Minimal Usage**: Simplest possible setup
|
|
191
|
-
3. **Customized Usage**: Advanced styling and configuration options
|
|
192
|
-
4. **Feature Demos**: Showcasing specific features like function calls, file uploads, etc.
|
|
193
|
-
|
|
194
|
-
## Integration Guide
|
|
195
|
-
|
|
196
|
-
### 1. Installation
|
|
197
|
-
|
|
198
|
-
The components are part of the app-studio component library and can be imported directly:
|
|
199
|
-
|
|
200
|
-
```tsx
|
|
201
|
-
import { AgentChat, AgentSession } from '@app-studio/web';
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### 2. Backend Setup
|
|
205
|
-
|
|
206
|
-
Ensure your ADK backend provides the required endpoints and follows the expected API format.
|
|
207
|
-
|
|
208
|
-
### 3. Basic Implementation
|
|
209
|
-
|
|
210
|
-
```tsx
|
|
211
|
-
import React from 'react';
|
|
212
|
-
import { AgentChat, AgentSession } from '@app-studio/web';
|
|
213
|
-
import { View, Horizontal } from 'app-studio';
|
|
214
|
-
|
|
215
|
-
const MyAgentApp = () => {
|
|
216
|
-
return (
|
|
217
|
-
<View height="100vh" padding={20}>
|
|
218
|
-
<Horizontal gap={20} height="100%">
|
|
219
|
-
{/* Session Management */}
|
|
220
|
-
<View width="300px">
|
|
221
|
-
<AgentSession
|
|
222
|
-
appName="my-agent"
|
|
223
|
-
userId="user123"
|
|
224
|
-
apiBaseUrl="https://api.example.com"
|
|
225
|
-
/>
|
|
226
|
-
</View>
|
|
227
|
-
|
|
228
|
-
{/* Chat Interface */}
|
|
229
|
-
<View flex={1}>
|
|
230
|
-
<AgentChat
|
|
231
|
-
appName="my-agent"
|
|
232
|
-
userId="user123"
|
|
233
|
-
apiBaseUrl="https://api.example.com"
|
|
234
|
-
/>
|
|
235
|
-
</View>
|
|
236
|
-
</Horizontal>
|
|
237
|
-
</View>
|
|
238
|
-
);
|
|
239
|
-
};
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
### 4. Advanced Configuration
|
|
243
|
-
|
|
244
|
-
```tsx
|
|
245
|
-
<AgentChat
|
|
246
|
-
appName="my-agent"
|
|
247
|
-
userId="user123"
|
|
248
|
-
apiBaseUrl="https://api.example.com"
|
|
249
|
-
enableFileUpload={true}
|
|
250
|
-
enableStreaming={true}
|
|
251
|
-
enableThoughts={true}
|
|
252
|
-
maxFileSize={10 * 1024 * 1024}
|
|
253
|
-
allowedFileTypes={['image/*', 'video/*', 'application/pdf']}
|
|
254
|
-
onSessionCreate={(session) => {
|
|
255
|
-
console.log('New session:', session);
|
|
256
|
-
}}
|
|
257
|
-
onMessageSent={(message) => {
|
|
258
|
-
console.log('Message sent:', message);
|
|
259
|
-
}}
|
|
260
|
-
onError={(error) => {
|
|
261
|
-
console.error('Chat error:', error);
|
|
262
|
-
}}
|
|
263
|
-
views={{
|
|
264
|
-
container: { backgroundColor: 'color.gray.50' },
|
|
265
|
-
userMessage: { backgroundColor: 'color.blue.500' },
|
|
266
|
-
botMessage: { backgroundColor: 'color.green.100' },
|
|
267
|
-
}}
|
|
268
|
-
/>
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
## Complete Component Library
|
|
272
|
-
|
|
273
|
-
All planned components have been successfully implemented:
|
|
274
|
-
|
|
275
|
-
### ✅ **AgentTrace Component**
|
|
276
|
-
- **Timeline visualization** of agent execution traces
|
|
277
|
-
- **Event filtering and search** capabilities
|
|
278
|
-
- **Performance metrics** and analytics
|
|
279
|
-
- **Real-time trace updates** via WebSocket
|
|
280
|
-
- **Multiple visualization types** (timeline, tree, table, flamegraph)
|
|
281
|
-
- **Export functionality** (JSON, CSV, SVG)
|
|
282
|
-
|
|
283
|
-
### ✅ **AgentEval Component**
|
|
284
|
-
- **Evaluation creation and management** interface
|
|
285
|
-
- **Test case execution** and monitoring
|
|
286
|
-
- **Results analysis** and comparison
|
|
287
|
-
- **Metrics calculation** and visualization
|
|
288
|
-
- **Batch evaluation** support
|
|
289
|
-
- **Template system** for reusable evaluations
|
|
290
|
-
|
|
291
|
-
### ✅ **Agent Service Integration**
|
|
292
|
-
- **Enhanced service layer** for backend communication
|
|
293
|
-
- **React Provider pattern** for service management
|
|
294
|
-
- **Utility functions** for common operations
|
|
295
|
-
- **Real-time updates** via WebSocket and SSE
|
|
296
|
-
- **Error handling and retry logic**
|
|
297
|
-
- **Connection status monitoring**
|
|
298
|
-
|
|
299
|
-
## Demo Page
|
|
300
|
-
|
|
301
|
-
A comprehensive demo page showcasing all components is available at:
|
|
302
|
-
- **File**: `src/pages/adkComponents.page.tsx`
|
|
303
|
-
- **Features**: Interactive demos, customization examples, integration guides
|
|
304
|
-
|
|
305
|
-
## Support
|
|
306
|
-
|
|
307
|
-
For questions, issues, or contributions related to the ADK Agent Components, please refer to the main app-studio documentation or create an issue in the repository.
|
|
308
|
-
|
|
309
|
-
## Production Ready
|
|
310
|
-
|
|
311
|
-
All ADK Agent Components are **production-ready** and provide:
|
|
312
|
-
- ✅ Full ADK backend compatibility
|
|
313
|
-
- ✅ TypeScript support with comprehensive type definitions
|
|
314
|
-
- ✅ Accessibility compliance (ARIA labels, keyboard navigation)
|
|
315
|
-
- ✅ Responsive design for mobile, tablet, and desktop
|
|
316
|
-
- ✅ Comprehensive error handling and loading states
|
|
317
|
-
- ✅ Real-time updates and streaming support
|
|
318
|
-
- ✅ Extensive customization options
|
|
319
|
-
- ✅ Complete documentation and examples
|
package/docs/adk-quick-start.md
DELETED
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
# ADK Components Quick Start Guide
|
|
2
|
-
|
|
3
|
-
Get up and running with ADK Agent Components in minutes.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
The ADK components are part of the app-studio component library:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @app-studio/web
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Basic Setup
|
|
14
|
-
|
|
15
|
-
### 1. Import Components
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
import {
|
|
19
|
-
AgentChat,
|
|
20
|
-
AgentSession,
|
|
21
|
-
AgentTrace,
|
|
22
|
-
AgentEval
|
|
23
|
-
} from '@app-studio/web';
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### 2. Use Components
|
|
27
|
-
|
|
28
|
-
The ADK components are self-contained and handle their own API communications. Simply add them to your application and provide the necessary props.
|
|
29
|
-
|
|
30
|
-
```tsx
|
|
31
|
-
function YourApp() {
|
|
32
|
-
return (
|
|
33
|
-
<div style={{ display: 'flex', height: '100vh' }}>
|
|
34
|
-
{/* Session Management */}
|
|
35
|
-
<div style={{ width: '300px' }}>
|
|
36
|
-
<AgentSession
|
|
37
|
-
appName="my-agent"
|
|
38
|
-
userId="user123"
|
|
39
|
-
apiBaseUrl="https://your-adk-api.com"
|
|
40
|
-
/>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
{/* Chat Interface */}
|
|
44
|
-
<div style={{ flex: 1 }}>
|
|
45
|
-
<AgentChat
|
|
46
|
-
appName="my-agent"
|
|
47
|
-
userId="user123"
|
|
48
|
-
apiBaseUrl="https://your-adk-api.com"
|
|
49
|
-
enableFileUpload={true}
|
|
50
|
-
enableStreaming={true}
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Component Overview
|
|
59
|
-
|
|
60
|
-
### AgentChat
|
|
61
|
-
**Purpose**: Real-time chat interface with ADK agents
|
|
62
|
-
**Key Features**: File uploads, audio recording, streaming, function calls, code execution
|
|
63
|
-
|
|
64
|
-
```tsx
|
|
65
|
-
<AgentChat
|
|
66
|
-
appName="my-agent"
|
|
67
|
-
userId="user123"
|
|
68
|
-
enableFileUpload={true}
|
|
69
|
-
enableAudioRecording={true}
|
|
70
|
-
enableStreaming={true}
|
|
71
|
-
enableThoughts={true}
|
|
72
|
-
onMessageSent={(message) => console.log(message)}
|
|
73
|
-
/>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### AgentSession
|
|
77
|
-
**Purpose**: Session management and organization
|
|
78
|
-
**Key Features**: Create, list, import/export, search sessions
|
|
79
|
-
|
|
80
|
-
```tsx
|
|
81
|
-
<AgentSession
|
|
82
|
-
appName="my-agent"
|
|
83
|
-
userId="user123"
|
|
84
|
-
showSessionHistory={true}
|
|
85
|
-
enableSessionImport={true}
|
|
86
|
-
enableSessionExport={true}
|
|
87
|
-
/>
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### AgentTrace
|
|
91
|
-
**Purpose**: Visualize agent execution traces
|
|
92
|
-
**Key Features**: Timeline view, performance metrics, real-time updates
|
|
93
|
-
|
|
94
|
-
```tsx
|
|
95
|
-
<AgentTrace
|
|
96
|
-
sessionId="session-123"
|
|
97
|
-
userId="user123"
|
|
98
|
-
appName="my-agent"
|
|
99
|
-
showTimeline={true}
|
|
100
|
-
showMetrics={true}
|
|
101
|
-
enableFiltering={true}
|
|
102
|
-
/>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### AgentEval
|
|
106
|
-
**Purpose**: Run and manage agent evaluations
|
|
107
|
-
**Key Features**: Test creation, execution monitoring, results analysis
|
|
108
|
-
|
|
109
|
-
```tsx
|
|
110
|
-
<AgentEval
|
|
111
|
-
appName="my-agent"
|
|
112
|
-
userId="user123"
|
|
113
|
-
enableBatchEvaluation={true}
|
|
114
|
-
enableMetricsComparison={true}
|
|
115
|
-
enableResultExport={true}
|
|
116
|
-
/>
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Common Patterns
|
|
120
|
-
|
|
121
|
-
### 1. Complete Agent Interface
|
|
122
|
-
|
|
123
|
-
```tsx
|
|
124
|
-
import { Tabs } from 'app-studio';
|
|
125
|
-
|
|
126
|
-
function AgentInterface() {
|
|
127
|
-
return (
|
|
128
|
-
<Tabs defaultValue="chat">
|
|
129
|
-
<Tabs.List>
|
|
130
|
-
<Tabs.Trigger value="chat">Chat</Tabs.Trigger>
|
|
131
|
-
<Tabs.Trigger value="sessions">Sessions</Tabs.Trigger>
|
|
132
|
-
<Tabs.Trigger value="trace">Trace</Tabs.Trigger>
|
|
133
|
-
<Tabs.Trigger value="eval">Evaluation</Tabs.Trigger>
|
|
134
|
-
</Tabs.List>
|
|
135
|
-
|
|
136
|
-
<Tabs.Content value="chat">
|
|
137
|
-
<AgentChat appName="my-agent" userId="user123" />
|
|
138
|
-
</Tabs.Content>
|
|
139
|
-
|
|
140
|
-
<Tabs.Content value="sessions">
|
|
141
|
-
<AgentSession appName="my-agent" userId="user123" />
|
|
142
|
-
</Tabs.Content>
|
|
143
|
-
|
|
144
|
-
<Tabs.Content value="trace">
|
|
145
|
-
<AgentTrace sessionId="current-session" userId="user123" appName="my-agent" />
|
|
146
|
-
</Tabs.Content>
|
|
147
|
-
|
|
148
|
-
<Tabs.Content value="eval">
|
|
149
|
-
<AgentEval appName="my-agent" userId="user123" />
|
|
150
|
-
</Tabs.Content>
|
|
151
|
-
</Tabs>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### 2. Custom Styling
|
|
157
|
-
|
|
158
|
-
```tsx
|
|
159
|
-
<AgentChat
|
|
160
|
-
appName="my-agent"
|
|
161
|
-
userId="user123"
|
|
162
|
-
views={{
|
|
163
|
-
container: { backgroundColor: 'color.blue.50' },
|
|
164
|
-
userMessage: { backgroundColor: 'color.blue.500' },
|
|
165
|
-
botMessage: { backgroundColor: 'color.green.100' },
|
|
166
|
-
inputField: { borderColor: 'color.blue.300' },
|
|
167
|
-
}}
|
|
168
|
-
/>
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### 3. Event Handling
|
|
172
|
-
|
|
173
|
-
```tsx
|
|
174
|
-
function MyComponent() {
|
|
175
|
-
const handleSessionCreate = (session) => {
|
|
176
|
-
console.log('New session created:', session);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
const handleMessageSent = (message) => {
|
|
180
|
-
console.log('Message sent:', message);
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
const handleError = (error) => {
|
|
184
|
-
console.error('Error:', error);
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
return (
|
|
188
|
-
<AgentChat
|
|
189
|
-
appName="my-agent"
|
|
190
|
-
userId="user123"
|
|
191
|
-
onSessionCreate={handleSessionCreate}
|
|
192
|
-
onMessageSent={handleMessageSent}
|
|
193
|
-
onError={handleError}
|
|
194
|
-
/>
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
## Backend Requirements
|
|
200
|
-
|
|
201
|
-
Your ADK backend must provide these endpoints:
|
|
202
|
-
|
|
203
|
-
### Session Management
|
|
204
|
-
- `POST /sessions` - Create session
|
|
205
|
-
- `GET /sessions` - List sessions
|
|
206
|
-
- `GET /sessions/:id` - Get session
|
|
207
|
-
- `DELETE /sessions/:id` - Delete session
|
|
208
|
-
|
|
209
|
-
### Messaging
|
|
210
|
-
- `POST /run` - Send message (non-streaming)
|
|
211
|
-
- `POST /run_sse` - Send message (streaming)
|
|
212
|
-
|
|
213
|
-
### Tracing (Optional)
|
|
214
|
-
- `GET /trace/events` - Get trace events
|
|
215
|
-
- `GET /trace/spans` - Get trace spans
|
|
216
|
-
- `GET /trace/metrics` - Get trace metrics
|
|
217
|
-
|
|
218
|
-
### Evaluation (Optional)
|
|
219
|
-
- `POST /evaluations` - Create evaluation
|
|
220
|
-
- `GET /evaluations` - List evaluations
|
|
221
|
-
- `POST /evaluations/:id/start` - Start evaluation
|
|
222
|
-
|
|
223
|
-
## Environment Variables
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
# .env
|
|
227
|
-
REACT_APP_AGENT_API_URL=https://your-adk-api.com
|
|
228
|
-
REACT_APP_AGENT_API_KEY=your-api-key
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
## TypeScript Support
|
|
232
|
-
|
|
233
|
-
All components include comprehensive TypeScript definitions:
|
|
234
|
-
|
|
235
|
-
```tsx
|
|
236
|
-
import type {
|
|
237
|
-
AgentChatProps,
|
|
238
|
-
AgentSessionProps,
|
|
239
|
-
AgentTraceProps,
|
|
240
|
-
AgentEvalProps,
|
|
241
|
-
AgentMessage,
|
|
242
|
-
AgentSession,
|
|
243
|
-
TraceEvent,
|
|
244
|
-
EvaluationRun
|
|
245
|
-
} from '@app-studio/web';
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
## Troubleshooting
|
|
249
|
-
|
|
250
|
-
### Common Issues
|
|
251
|
-
|
|
252
|
-
1. **API errors**: Check the `apiBaseUrl` prop and ensure your backend URL and API endpoints are correct.
|
|
253
|
-
2. **Styling issues**: Verify you're using the app-studio color system.
|
|
254
|
-
3. **TypeScript errors**: Import types from the correct package.
|
|
255
|
-
|
|
256
|
-
## Next Steps
|
|
257
|
-
|
|
258
|
-
- Explore the [complete documentation](./adk-components.md)
|
|
259
|
-
- Check out the [demo page](../src/pages/adkComponents.page.tsx)
|
|
260
|
-
- View component examples in each component's `examples/` directory
|
|
261
|
-
- Customize components using the `views` prop system
|
|
262
|
-
|
|
263
|
-
## Support
|
|
264
|
-
|
|
265
|
-
For questions or issues:
|
|
266
|
-
- Check the component documentation
|
|
267
|
-
- Review the example implementations
|
|
268
|
-
- Create an issue in the repository
|