This directory contains comprehensive example applications demonstrating the full capabilities of the AgentArea UI SDK, including all new components and features.
A complete React application with Vite showcasing all SDK capabilities:
cd react-example
pnpm install
pnpm devFeatures demonstrated:
- AgentUI Entry Point: Unified component with runtime management
- Artifact Display: Rich rendering for code, data, files, images, and text
- Input Collection: Dynamic forms, approvals, selections, and file uploads
- Communication Blocks: Protocol messages, status updates, and metadata
- Enhanced Task Management: Input requests and artifact integration
- Debug Tools: Comprehensive development and debugging features
Next.js application demonstrating SSR integration and production patterns:
cd react-nextjs-example
pnpm install
pnpm devFeatures demonstrated:
- SSR-Safe Components: Hydration-aware initialization and state management
- Performance Optimizations: Code splitting, lazy loading, and caching
- Production Features: Error boundaries, loading states, and SEO optimization
- Environment Detection: Automatic Next.js environment adaptation
- Streaming Support: Progressive loading with React Suspense
Comprehensive example showcasing multiple agent communication protocols:
cd multi-runtime-example
pnpm install
pnpm devFeatures demonstrated:
- A2A Protocol: Google's Agent-to-Agent communication standard
- AgentArea Custom: Enhanced custom protocol with additional features
- Runtime Switching: Dynamic switching between different protocols
- Protocol Comparison: Side-by-side feature comparison and capabilities
- Environment Support: Vite integration with performance monitoring
- Node.js 18+
- pnpm (recommended) or npm
-
Build the SDK first (from repository root):
pnpm build
-
Navigate to example directory:
cd examples/[example-name] -
Install dependencies:
pnpm install
-
Start development server:
pnpm dev
-
Build for production:
pnpm build
// All-in-one component
<AgentUI
runtime="a2a"
endpoint="https://api.example.com"
autoConnect
debug
>
<Task id="task-1" />
<Chat taskId="task-1" />
</AgentUI>
// Compound component pattern
<AgentUI.Provider runtime="agentarea">
<AgentUI.Connection showLatency showActions />
<Task.List />
<AgentUI.Debug showEnvironment />
</AgentUI.Provider>Artifact Display
<Artifact artifact={artifact} onDownload={handleDownload} />
<Artifact.Code artifact={codeArtifact} />
<Artifact.Data artifact={dataArtifact} />
<Artifact.File artifact={fileArtifact} />Input Collection
<Input.Approval request={approvalRequest} onApprove={handleApprove} />
<Input.Selection request={selectionRequest} multiSelect />
<Input.Upload onUpload={handleUpload} dragAndDrop />
<Input.Form schema={formSchema} onSubmit={handleSubmit} />Communication Blocks
<Block.Message message={protocolMessage} expandable />
<Block.Protocol protocol={protocolInfo} showFeatures />
<Block.Status status={connectionStatus} realTime />
<Block.Metadata metadata={executionData} expandable />- β‘ Lightning-fast HMR and development
- π¦ Optimized bundling and tree-shaking
- π§ TypeScript support out of the box
- π― Modern browser targeting
- π Server-side rendering and static generation
- β‘ Automatic code splitting and optimization
- π± Progressive web app capabilities
- π SEO-friendly with proper meta tags
- π A2A protocol integration
- β‘ AgentArea custom protocol
- π Dynamic runtime switching
- π Protocol comparison and analytics
All examples include comprehensive debugging:
<AgentUI.Debug
showEnvironment // Runtime environment info
showRuntime // Active runtime details
showConnections // Connection status
showConfig // Configuration dump
/>- Component-level error isolation
- Graceful degradation for unsupported features
- Retry mechanisms with exponential backoff
- Clear error messaging with actionable guidance
- Bundle size analysis and optimization
- Runtime performance metrics
- Memory usage tracking
- Connection latency monitoring
# Common environment variables
NEXT_PUBLIC_AGENT_ENDPOINT=https://your-agent-api.com
NEXT_PUBLIC_DEBUG_MODE=false
AGENT_API_KEY=your-secret-keyFROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]# Deploy to Vercel
vercel
# Automatic deployments with GitHub integration
# Environment variables configured in Vercel dashboardExamples use local SDK builds for development:
{
"dependencies": {
"@agentarea/core": "file:../../packages/core",
"@agentarea/react": "file:../../packages/react"
}
}In production, install from npm:
npm install @agentarea/core @agentarea/react// Main components and hooks
import {
AgentUI,
Task,
Chat,
Artifact,
Input,
Block,
useTask,
useArtifacts,
useAgentConnection
} from '@agentarea/react'
// Core runtime and types
import {
createA2ARuntime,
createAgentAreaRuntime
} from '@agentarea/core'- Use error boundaries around component groups
- Implement loading states for better UX
- Handle offline scenarios gracefully
- Provide fallbacks for unsupported features
- Use React.memo for expensive components
- Implement virtual scrolling for large lists
- Cache artifacts and metadata locally
- Optimize re-renders with proper dependencies
- All components follow WCAG 2.1 AA standards
- Keyboard navigation support
- Screen reader compatibility
- High contrast theme support
- Validate all inputs on both client and server
- Use environment variables for sensitive configuration
- Implement proper CORS policies
- Sanitize user-generated content
Build Errors
- Ensure SDK is built first:
pnpm buildfrom root - Check TypeScript configuration and imports
- Verify all dependencies are installed
Runtime Connection Issues
- Verify endpoint URL and authentication
- Check network connectivity and CORS settings
- Enable debug mode for detailed logs
SSR Hydration Issues (Next.js)
- Use
useIsClient()hook for client-only features - Implement proper loading states during hydration
- Handle WebSocket connections client-side only
Performance Issues
- Use React DevTools Profiler
- Check for unnecessary re-renders
- Optimize large artifact rendering
- Monitor bundle size and lazy load components
Enable comprehensive debugging in any example:
<AgentUI debug devTools>
{/* Detailed logging and state inspection */}
</AgentUI>These examples are part of the AgentArea UI SDK monorepo. To contribute:
- Fork the repository
- Create a feature branch
- Make your changes to examples
- Test across different frameworks
- Update documentation as needed
- Submit a pull request
To add a new example:
- Create a new directory in
examples/ - Set up the framework (React, Vue, Angular, etc.)
- Add SDK dependencies using file references
- Implement comprehensive component showcase
- Add detailed README with setup instructions
- Update this main examples README
- Explore Components: Start with the React example for comprehensive component showcase
- Learn SSR: Check the Next.js example for server-side rendering patterns
- Multi-Protocol: Try the multi-runtime example for protocol switching
- Read Docs: Review the main documentation for detailed API reference
- View Stories: Check Storybook stories for component documentation
- React 19 - UI library with concurrent features
- Next.js 15 - React framework with SSR
- Vite - Build tool and dev server
- TypeScript - Type safety
- Tailwind CSS - Utility-first styling
- AgentArea UI SDK - Agent communication components