A complete chat application built with React, Vite, and the Polpo React SDK. Features streaming responses, session history, agent selection, tool call display, and dark/light theme.
Quick start
Environment variables
Run locally
What’s included
Polpo React SDK integration
The app uses PolpoProvider for context and hooks for data:
Agent selection
On first load, the app fetches available agents using useAgents() and displays a selector:
Streaming chat completions
The app uses the useChat hook from the React SDK, which handles streaming, session management, and abort automatically:
useChat manages the session ID internally. The first message creates a new session, and subsequent messages continue the same conversation automatically. You can call newSession() to start fresh.
For lower-level control, you can also use chatCompletionsStream() directly from the client SDK:
When using chatCompletionsStream directly, you must capture and pass the session ID yourself. Without sessionId, every request creates a new session.
Session history
Sessions are loaded from the server using useSessions():
The sidebar shows all past sessions with agent name and date.
When the agent executes tools (bash, read, write, etc.), tool call events appear as collapsible blocks showing the tool name, arguments, and result:
Abort / Stop
Streaming can be stopped at any time using the Stop button, which calls stream.abort().
Customization
Change the proxy target
Edit vite.config.ts to point to a different server:
Add more features
The example is intentionally minimal. You can extend it with:
- File references — using
file content parts with workspace paths
- Approval gates — using
useApprovals() hook
- Task monitoring — using
useTasks() and useMissions() hooks
- Vault credentials — using
useVaultEntries() hook
All hooks are available from @polpo-ai/react. See the React SDK docs for the full API.