| Crates.io | adk-ui |
| lib.rs | adk-ui |
| version | 0.2.1 |
| created_at | 2025-12-12 16:19:35.370747+00 |
| updated_at | 2026-01-22 03:47:30.20919+00 |
| description | Dynamic UI generation for Rust Agent Development Kit (ADK-Rust) agents - render forms, cards, tables, charts and more |
| homepage | |
| repository | https://github.com/zavora-ai/adk-rust |
| max_upload_size | |
| id | 1981801 |
| size | 135,793 |
Dynamic UI generation for AI agents. Enables agents to render rich user interfaces through tool calls.
UiEventUiUpdate[dependencies]
adk-ui = "0.2.0"
use adk_ui::{UiToolset, UI_AGENT_PROMPT};
use adk_agent::LlmAgentBuilder;
// Add all 10 UI tools to an agent with the tested system prompt
let tools = UiToolset::all_tools();
let mut builder = LlmAgentBuilder::new("assistant")
.model(model)
.instruction(UI_AGENT_PROMPT); // Tested prompt for reliable tool usage
for tool in tools {
builder = builder.tool(tool);
}
let agent = builder.build()?;
prompts.rs)Tested system prompts for reliable LLM tool usage:
use adk_ui::{UI_AGENT_PROMPT, UI_AGENT_PROMPT_SHORT};
// UI_AGENT_PROMPT includes:
// - Critical rules for tool usage
// - Tool selection guide
// - Few-shot examples with JSON parameters
templates.rs)Pre-built UI patterns:
use adk_ui::{render_template, UiTemplate, TemplateData};
let response = render_template(UiTemplate::Registration, TemplateData::default());
Templates: Registration, Login, UserProfile, Settings, ConfirmDelete, StatusDashboard, DataTable, SuccessMessage, ErrorMessage, Loading
validation.rs)Server-side validation:
use adk_ui::{validate_ui_response, UiResponse};
let result = validate_ui_response(&ui_response);
if let Err(errors) = result {
eprintln!("Validation errors: {:?}", errors);
}
| Tool | Description |
|---|---|
render_form |
Collect user input with forms (text, email, password, textarea, select, etc.) |
render_card |
Display information cards with actions |
render_alert |
Show notifications and status messages |
render_confirm |
Request user confirmation |
render_table |
Display tabular data with sorting and pagination |
render_chart |
Create bar, line, area, and pie charts with legend/axis labels |
render_layout |
Build dashboard layouts with 8 section types |
render_progress |
Show progress indicators |
render_modal |
Display modal dialogs |
render_toast |
Show temporary toast notifications |
Update specific components by ID without re-rendering:
use adk_ui::{UiUpdate, Component, Progress};
let update = UiUpdate::replace(
"progress-bar",
Component::Progress(Progress {
id: Some("progress-bar".to_string()),
value: 75,
label: Some("75%".to_string()),
}),
);
Install the npm package:
npm install @zavora-ai/adk-ui-react
import { Renderer } from '@zavora-ai/adk-ui-react';
import type { UiResponse, UiEvent } from '@zavora-ai/adk-ui-react';
Or use the reference implementation in examples/ui_react_client/.
| Example | Description | Command |
|---|---|---|
ui_agent |
Console demo | cargo run --example ui_agent |
ui_server |
HTTP server with SSE | cargo run --example ui_server |
streaming_demo |
Real-time progress updates | cargo run --example streaming_demo |
ui_react_client |
React frontend | cd examples/ui_react_client && npm run dev |
Agent ──[render_* tool]──> UiResponse ──[SSE]──> React Client
↑ │
└────────── UiEvent <────────────────────┘
Apache-2.0
This crate is part of the ADK-Rust framework for building AI agents in Rust.