A sample React TypeScript application for interacting with UiPath Conversational Agents. Features real-time streaming responses over WebSocket, conversation management, file attachments, tool call visualization, and feedback.
npm install @uipath/uipath-typescript- Node.js 18+ installed
- UiPath Cloud tenant access
- OAuth External Application configured in UiPath Admin Center
- At least one Conversational Agent deployed in your tenant
-
In UiPath Cloud: Admin > External Applications
-
Click Add Application > Non Confidential Application
-
Configure:
- Name: Your app name (e.g., "Conversational Agent App")
- Redirect URI:
http://localhost:5173/callback(for development) - Scopes:
OR.Execution,OR.Folders,OR.Jobs,ConversationalAgents,Traces.Api
-
Save and copy the Client ID
Note: The
ConversationalAgentsscope is required for real-time WebSocket sessions. Without it, REST API calls will work but the socket connection will fail. See the OAuth Scopes Reference for details.
-
Copy the environment template:
cp .env.example .env
-
Update
.envwith your UiPath credentials:VITE_UIPATH_BASE_URL=https://cloud.uipath.com VITE_UIPATH_CLIENT_ID=your-oauth-client-id VITE_UIPATH_REDIRECT_URI=http://localhost:5173/callback VITE_UIPATH_SCOPE=OR.Execution OR.Folders OR.Jobs ConversationalAgents Traces.Api VITE_UIPATH_ORG_NAME=your-organization-name VITE_UIPATH_TENANT_NAME=your-tenant-name
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser to
http://localhost:5173
- Click "Sign in with UiPath"
- You'll be redirected to UiPath Cloud for authentication
- After successful login, you'll return to the app
- The app will automatically initialize the UiPath SDK
src/
├── components/
│ ├── AgentSelector.tsx # Agent selection dropdown
│ ├── ChatArea.tsx # Message display area
│ ├── ChatInput.tsx # Text input with file attachments
│ ├── ChatLayout.tsx # Main layout with sidebar
│ ├── ErrorBoundary.tsx # React error boundary
│ ├── LoginScreen.tsx # OAuth login interface
│ ├── MessageBubble.tsx # Message rendering (markdown, images, citations)
│ ├── Sidebar.tsx # Conversation list and management
│ ├── Spinner.tsx # Loading indicator
│ └── WelcomeScreen.tsx # Initial screen before conversation
├── context/
│ ├── AuthContext.tsx # OAuth authentication context
│ └── ConversationalAgentContext.tsx # Agent orchestration layer
├── hooks/
│ ├── useAgents.ts # Agent discovery and selection
│ ├── useChat.ts # Messages, streaming, exchanges, feedback, interrupts
│ └── useConversations.ts # Conversation CRUD and pagination
├── types.ts # Shared type definitions
├── App.tsx # Main application component
└── main.tsx # Entry point
- WebSocket streaming with chunked markdown rendering
- Multi-turn conversations with shared context
- Connection status monitoring and error handling
- Markdown with syntax highlighting
- HTML content rendering
- Image display
- Citations with source links
- Create, rename, and delete conversations
- Conversation history with pagination
- Auto-generated conversation labels
- Tool call visualization (name, input, output)
- Interrupt handling (tool call confirmation prompts)
- Exchange-level feedback (thumbs up/down)
- Upload files to conversations
- Attach files to messages
- React 19 with TypeScript
- Vite for fast development and building
- Tailwind CSS for styling
- UiPath TypeScript SDK for API and WebSocket integration
- OAuth 2.0 for secure authentication
npm run buildThe built application will be in the dist/ directory.
-
Authentication fails: Verify your OAuth client ID and redirect URI match your UiPath External Application configuration
-
WebSocket connection fails: Ensure the
ConversationalAgentsscope is included in your OAuth application -
No agents found: Verify you have at least one Conversational Agent deployed and your user has access to the folder containing the agent
-
Build errors: Make sure all environment variables are properly set in
.env