AgentCircuits.UI 0.5.2

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AgentCircuits.UI" Version="0.5.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AgentCircuits.UI" Version="0.5.2" />
                    
Directory.Packages.props
<PackageReference Include="AgentCircuits.UI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AgentCircuits.UI --version 0.5.2
                    
#r "nuget: AgentCircuits.UI, 0.5.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AgentCircuits.UI@0.5.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AgentCircuits.UI&version=0.5.2
                    
Install as a Cake Addin
#tool nuget:?package=AgentCircuits.UI&version=0.5.2
                    
Install as a Cake Tool

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

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 dev runs a dev script with legacy paths. Use npx vite directly 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:

  1. Connection indicator (bottom-right) showing "Connected" in green
  2. Session list in the sidebar (may be empty initially)
  3. Chat input at the bottom

5. Send Your First Message

  1. The UI auto-selects the first available agent
  2. Type a message and press Enter
  3. 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

  1. User sends message via ChatStore.sendMessage()
  2. Message sent to portal via SignalRService.executeAgent()
  3. Portal executes agent, streams events back
  4. Events received via AgentEvent callback
  5. EventStore.handleEvent() processes each event
  6. UI reactively updates from EventStore.messages
  7. ExecutionComplete callback 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:

  1. On load, fetches agents from /api/agents
  2. Selects first agent (or from localStorage if previously set)
  3. 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

  1. Connection

    • Status indicator shows "Connected" (green)
    • Reconnects automatically after network interruption
  2. Chat Flow

    • Send a text message
    • See streaming response
    • Thinking content displays (if agent uses reasoning)
    • Tool calls display with status indicators
  3. Session Management

    • Session appears in sidebar after first message
    • Click session to load history
    • "New chat" button clears state
    • Delete session removes from list
  4. 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:

  1. Open Portal UI at http://localhost:56433
  2. Create an agent configuration
  3. Refresh the UI

Messages Not Sending

  • Check connection status indicator
  • Check browser console for errors
  • Verify an agent is selected (check sessions store)

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed