Components / agent
AgentRoster builder
A virtualized list of agents with standard identity and activity rows.
A builder is RenderOnce. Construct and mount it in one expression.
use gpui_kit::agent::AgentRoster;
Reviewed in agent-roster.
Construct
new(ident: impl Into<Ident>, agents: impl IntoIterator<Item = AgentSnapshot>) -> Self
from_run(ident: impl Into<Ident>, run: &AgentRunSnapshot) -> Self
Options
Chain onto the value.
tasks(tasks: impl IntoIterator<Item = AgentTaskSnapshot>) -> Self
appearances(appearances: impl IntoIterator<Item = AgentAppearance>) -> Self
selected(selected: impl Into<AgentId>) -> Self
visible_rows(rows: usize) -> Self
on_action(handler: impl Fn(AgentUiAction, &mut Window, &mut App) + 'static) -> Self
Example · agent-roster
fn agent_roster(_window: &mut Window, cx: &mut App) -> AnyElement {
let theme = cx.theme().clone();
let direction = cx.layout_direction();
let run = scene_agent_run();
let root = run
.agents
.first()
.cloned()
.expect("the canonical multi-agent scene has a root agent");
stack(&theme)
.w(px(720.0))
.child(
div()
.row_reading(direction)
.items_center()
.justify_between()
.child(
div()
.column()
.gap_token(&theme, Space::Xs)
.child(
div()
.type_scale(&theme, TypeScale::Title)
.text_tone(&theme, TextTone::Primary)
.child("Release review"),
)
.child(AgentActivityLine::new(
"scene.agent-roster.run-state",
run.execution.clone(),
)),
)
.child(
AgentGroup::new("scene.agent-roster.group", run.agents.clone()).max_visible(3),
),
)
.child(
AgentCard::new("scene.agent-roster.root", root)
.task_label("Synthesis")
.selected(true)
.on_action(|_, _, _| {}),
)
.child(
div()
.row_reading(direction)
.items_start()
.gap_token(&theme, Space::Lg)
.child(
div().w(px(420.0)).child(
AgentRoster::from_run("scene.agent-roster.list", &run)
.selected("researcher")
.visible_rows(4)
.on_action(|_, _, _| {}),
),
)
.child(
div().w(px(270.0)).child(
SubagentTree::new("scene.agent-roster.tree", run)
.expanded(["orchestrator".into(), "researcher".into()])
.selected("researcher")
.visible_rows(4)
.on_toggle(|_, _, _, _| {})
.on_action(|_, _, _| {}),
),
),
)
.into_any_element()
}