AgentCircuits.UI
0.5.2
See the version list below for details.
dotnet add package AgentCircuits.UI --version 0.5.2
NuGet\Install-Package AgentCircuits.UI -Version 0.5.2
<PackageReference Include="AgentCircuits.UI" Version="0.5.2" />
<PackageVersion Include="AgentCircuits.UI" Version="0.5.2" />
<PackageReference Include="AgentCircuits.UI" />
paket add AgentCircuits.UI --version 0.5.2
#r "nuget: AgentCircuits.UI, 0.5.2"
#:package AgentCircuits.UI@0.5.2
#addin nuget:?package=AgentCircuits.UI&version=0.5.2
#tool nuget:?package=AgentCircuits.UI&version=0.5.2
AgentCircuits.UI
A modern chat interface for AgentCircuits agents, built with SvelteKit. This UI connects to an AgentCircuits Portal backend via SignalR and provides real-time streaming of agent responses, tool call visualisation, and session management.
Table of Contents
Features
Chat Interface
- Streaming responses - Real-time text streaming via SignalR
- Thinking/reasoning display - Collapsible reasoning content blocks
- Dark/light theme - System preference detection with manual override
- Responsive design - Desktop and mobile support
Tool Call Visualisation
- Collapsible tool calls - View tool name, arguments, and results
- Status indicators - Pending (spinner), success (tick), error (cross)
- Result pairing - Tool results matched to invocations by ID
Session Management
- Session list - Browse previous conversations
- Session switching - Load any session's history
- New session - Start fresh conversations
- Delete session - Remove unwanted sessions
Metrics Display
- Token counts - Input/output tokens per turn
- Cost tracking - USD cost when available
- Performance metrics - TTFT, tokens per second
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Enter |
Send message |
Shift+Ctrl/Cmd+O |
New chat |
Shift+Ctrl/Cmd+D |
Delete conversation |
Ctrl/Cmd+K |
Search conversations |
Installation
NuGet Package (Recommended for Production)
The UI is distributed as a NuGet package with pre-built assets embedded. No Node.js required at runtime.
dotnet add package AgentCircuits.UI
Usage:
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
// Mount at root "/"
app.UseAgentCircuitsUI();
// Or mount at a specific path
app.UseAgentCircuitsUI("/chat");
// With custom options
app.UseAgentCircuitsUI("/chat", options =>
{
options.EnableCacheControlHeaders = false;
options.EnableSpaFallback = true;
});
app.Run();
Configuration Options:
| Option | Default | Description |
|---|---|---|
IncludeStaticFiles |
true |
Serve static files from embedded resources |
EnableCacheControlHeaders |
true |
Add cache control headers to responses |
CacheControlValue |
"no-cache, no-store, must-revalidate" |
Cache-Control header value |
EnableSpaFallback |
true |
Serve index.html for non-file routes (SPA routing) |
ApiBasePath |
null |
Optional API base path to inject (e.g., /portal) |
HubsBasePath |
null |
Optional SignalR hubs base path (defaults to ApiBasePath) |
The middleware serves the pre-built SvelteKit assets from embedded resources and handles SPA fallback routing automatically.
Development Setup
Prerequisites
- Node.js 18+ (20+ recommended)
- npm 9+
- .NET 9.0 (for the Portal backend)
1. Start the Server Backend
The UI requires the AgentCircuits Server running. In a separate terminal:
cd /home/azik/code/agentcircuits
dotnet run --project agentcircuits.server/src/AgentCircuits.Server.csproj
The server runs at http://localhost:56433 by default.
Verify the backend is running:
# Check agents endpoint
curl http://localhost:56433/api/agents
# Check sessions endpoint
curl http://localhost:56433/api/sessions
2. Install UI Dependencies
cd /home/azik/code/agentcircuits/agentcircuits.ui
npm install
3. Start the UI Development Server
npx vite
Note:
npm run devruns a dev script with legacy paths. Usenpx vitedirectly for a cleaner start.
The UI runs at http://localhost:5173. The Vite dev server proxies API requests to the portal:
/api/*→http://localhost:56433/hubs/*→http://localhost:56433(WebSocket)
4. Open in Browser
Navigate to http://localhost:5173. You should see:
- Connection indicator (bottom-right) showing "Connected" in green
- Session list in the sidebar (may be empty initially)
- Chat input at the bottom
5. Send Your First Message
- The UI auto-selects the first available agent
- Type a message and press Enter
- Watch the streaming response appear
Architecture
Overview
AgentCircuits.UI (SvelteKit)
│
│ SignalR WebSocket
▼
AgentCircuits.Portal (ASP.NET Core)
│
│ Agent Execution
▼
AgentCircuits SDK (Agent, Tools, LLM Providers)
Key Components
| Component | Purpose |
|---|---|
| SignalRService | WebSocket connection to portal's ExecutionHub |
| EventStore | Aggregates streaming events into UI messages |
| SessionsStore | Manages session list and active session |
| ChatStore | Orchestrates message sending and callbacks |
Data Flow
- User sends message via
ChatStore.sendMessage() - Message sent to portal via
SignalRService.executeAgent() - Portal executes agent, streams events back
- Events received via
AgentEventcallback EventStore.handleEvent()processes each event- UI reactively updates from
EventStore.messages ExecutionCompletecallback captures session ID
Event Types
| Event | Purpose |
|---|---|
text |
Assistant text content (streams with partial: true) |
thinking |
Reasoning/thinking content |
tool_use |
Tool invocation (name, arguments) |
tool_result |
Tool outcome (success/error, result) |
turn_metrics |
Performance data (tokens, cost, timing) |
result |
Turn completion (includes session ID) |
Configuration
Environment Variables
Create a .env file or set these before running:
# Backend URL (default: same origin, proxied in dev)
VITE_API_BASE_URL=
# SignalR hub path (default: /hubs/execution)
VITE_HUB_PATH=/hubs/execution
Vite Proxy Configuration
The proxy is configured in vite.config.ts:
server: {
proxy: {
'/api': 'http://localhost:56433',
'/hubs': {
target: 'http://localhost:56433',
ws: true
}
}
}
Update the port if your portal runs on a different port.
Agent Selection
The UI uses single-agent mode:
- On load, fetches agents from
/api/agents - Selects first agent (or from localStorage if previously set)
- Agent ID persisted to localStorage as
defaultAgentId
Development
Development Server
npm run dev
This starts Vite with hot module replacement. Changes to .svelte, .ts, or .css files reload instantly.
Production Build
npm run build
Outputs static files to wwwroot/ (configurable in svelte.config.js).
Type Checking
npm run check
Linting and Formatting
npm run lint # Check code style
npm run format # Auto-format with Prettier
Useful Commands
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Production build |
npm run preview |
Preview production build |
npm run check |
TypeScript type checking |
npm run lint |
ESLint check |
npm run format |
Prettier format |
Testing
Manual Testing Checklist
Connection
- Status indicator shows "Connected" (green)
- Reconnects automatically after network interruption
Chat Flow
- Send a text message
- See streaming response
- Thinking content displays (if agent uses reasoning)
- Tool calls display with status indicators
Session Management
- Session appears in sidebar after first message
- Click session to load history
- "New chat" button clears state
- Delete session removes from list
Error Handling
- Error dialog shows on execution error
- Connection status shows "Disconnected" when portal stops
Running with a Test Agent
Ensure the portal has at least one agent configured:
# Check configured agents
curl http://localhost:56433/api/agents | jq
If no agents exist, create one via the Portal UI at http://localhost:56433.
Project Structure
agentcircuits.ui/
├── src/
│ ├── lib/
│ │ ├── components/ # UI components
│ │ │ ├── app/ # Application components
│ │ │ │ ├── chat/ # Chat interface components
│ │ │ │ ├── tools/ # Tool call display
│ │ │ │ └── ...
│ │ │ └── ui/ # shadcn-svelte primitives
│ │ ├── stores/ # State management (Svelte 5 runes)
│ │ │ ├── chat.svelte.ts
│ │ │ ├── connection.svelte.ts
│ │ │ ├── events.svelte.ts
│ │ │ ├── sessions.svelte.ts
│ │ │ └── ...
│ │ ├── services/ # API and SignalR services
│ │ │ └── signalr.ts
│ │ ├── types/ # TypeScript interfaces
│ │ │ ├── events.ts # AgentCircuits event types
│ │ │ └── ui.ts # UI model types
│ │ └── utils/ # Utility functions
│ ├── routes/ # SvelteKit routes
│ │ ├── +layout.svelte # Main layout with SignalR wiring
│ │ └── +page.svelte # Chat page
│ └── app.css # Global styles
├── static/ # Static assets
├── tests/ # Test files
├── vite.config.ts # Vite configuration
├── svelte.config.js # SvelteKit configuration
└── package.json
Tech Stack
| Layer | Technology | Purpose |
|---|---|---|
| Framework | SvelteKit + Svelte 5 | Reactive UI with runes |
| UI Components | shadcn-svelte + bits-ui | Accessible component library |
| Styling | TailwindCSS 4 | Utility-first CSS |
| Real-time | SignalR | WebSocket connection to portal |
| Build | Vite | Fast bundling |
| Markdown | remark + rehype | Content rendering |
Troubleshooting
Connection Issues
"Disconnected" status:
- Check portal is running:
curl http://localhost:56433/api/agents - Check port matches in
vite.config.ts - Check browser console for WebSocket errors
Port already in use: If you see "Address already in use" when starting the portal:
# Find and kill process using the port
fuser -k 56433/tcp
# Or on macOS
lsof -ti:56433 | xargs kill
CORS errors:
- Ensure you're accessing via
http://localhost:5173(Vite proxy) - Don't access the portal directly for the UI
Console shows /props 404:
This is expected - the /props endpoint is not used by the AgentCircuits Portal. The 404 is logged as a warning but doesn't affect functionality.
No Agents Available
If the agent selector is empty:
- Open Portal UI at
http://localhost:56433 - Create an agent configuration
- Refresh the UI
Messages Not Sending
- Check connection status indicator
- Check browser console for errors
- Verify an agent is selected (check sessions store)
Related Documentation
- AgentCircuits.UI Design Document - Full architecture and implementation details
- AgentCircuits Portal - Backend API and SignalR hub
- AgentCircuits SDK - Core agent framework
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.Extensions.FileProviders.Embedded (>= 9.0.6)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AgentCircuits.UI:
| Package | Downloads |
|---|---|
|
AgentCircuits.Server
Turnkey AgentCircuits server hosting Portal API, SignalR hubs, and UI endpoints. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.95 | 35 | 2/19/2026 |
| 0.7.94 | 37 | 2/18/2026 |
| 0.7.93 | 35 | 2/18/2026 |
| 0.7.92 | 39 | 2/18/2026 |
| 0.7.91 | 32 | 2/18/2026 |
| 0.7.9 | 36 | 2/18/2026 |
| 0.7.8 | 32 | 2/18/2026 |
| 0.7.7 | 79 | 2/16/2026 |
| 0.7.6 | 79 | 2/16/2026 |
| 0.7.5 | 81 | 2/16/2026 |
| 0.7.4 | 84 | 2/16/2026 |
| 0.7.3 | 84 | 2/16/2026 |
| 0.7.2 | 82 | 2/16/2026 |
| 0.7.0 | 96 | 2/12/2026 |
| 0.6.1 | 107 | 2/12/2026 |
| 0.6.0 | 125 | 2/8/2026 |
| 0.5.8 | 118 | 2/7/2026 |
| 0.5.6 | 116 | 2/5/2026 |
| 0.5.5 | 109 | 2/5/2026 |
| 0.5.2 | 115 | 2/5/2026 |