Package-level declarations

Types

Link copied to clipboard
@Immutable
data class AgentRunLabels(val prompt: String = "Prompt", val thinking: String = "Thinking", val answer: String = "Answer", val file: String = "File", val empty: String = "No steps yet", val sources: (count: Int) -> String = { "$it sources" })

Node titles for agentRunGraph; rememberAgentRunLabels reads them from resources.

Link copied to clipboard
data class CanvasEdge(val from: String, val to: String, val label: String? = null, val animated: Boolean = false, val temporary: Boolean = false)

A connection between two nodes (AI Elements <Edge>): animated edges show flowing dashes, temporary edges are dashed and muted (e.g. a proposed or pending link).

Link copied to clipboard
data class CanvasNode(val id: String, val title: String, val subtitle: String? = null, val position: DpOffset = DpOffset.Zero, val icon: ImageVector? = null, val tone: NodeTone = NodeTone.PRIMARY, val status: StepStatus? = null, val size: DpSize? = null, val data: Any? = null)

A node on a WorkflowCanvas (AI Elements <Node>); position is its top-left in canvas dp. size overrides the canvas' node size for this node; data carries your own payload for a custom nodeContent.

Link copied to clipboard

Color role of a CanvasNode.

Functions

Link copied to clipboard
fun agentRunGraph(message: Message, prompt: String?, nodeSize: DpSize = DpSize(200.dp, 64.dp), labels: AgentRunLabels = AgentRunLabels()): Pair<List<CanvasNode>, List<CanvasEdge>>

Lays an agent run out as a graph: prompt → reasoning / plan → tool calls (parallel calls side by side) → answer → sources. Consecutive tool calls form one row; every node in a row connects to every node in the next.

Link copied to clipboard

Localized node titles for agentRunGraph.

Link copied to clipboard
@Composable
fun WorkflowCanvas(nodes: List<CanvasNode>, edges: List<CanvasEdge>, modifier: Modifier = Modifier, nodeSize: DpSize = DpSize(200.dp, 64.dp), showControls: Boolean = true, onNodeClick: (CanvasNode) -> Unit? = null, nodeContent: @Composable (CanvasNode) -> Unit? = null, nodeToolbar: @Composable (CanvasNode) -> Unit? = null, panel: @Composable BoxScope.() -> Unit = {})

A pannable, pinch-zoomable node graph (AI Elements <Canvas>): dot-grid background, curved edges with arrowheads and optional labels, and zoom / fit controls (<Controls>). Edges run from a node's bottom to the next node's top.