+ @foreach (var step in Plan.Steps)
+ {
+
+ @step.Description
+
+ }
+
+}
+```
+
+### Try It
+
+1. Click on **"Agentic Generative UI"** in the sidebar
+2. Click **"Simple plan"** to ask for a Mars mission plan
+3. Watch the task progress card appear and steps update in real-time as the agent "executes" the plan
+
+---
+
+## 5. Tool-Based Generative UI
+
+The **Tool-Based Generative UI** scenario demonstrates how frontend tools can generate rich UI components. Unlike backend tool rendering (where the server returns data and the client renders it), here the frontend tool itself creates the UI, giving you full control over the presentation.
+
+
+
+### What It Shows
+
+- **Frontend Tool Execution**: Tools that run entirely on the client side
+- **Dynamic UI Generation**: Creating visual components (haiku cards) based on tool parameters
+- **Component Integration**: Tools updating component state directly
+- **Rich Content Display**: Combining text, images, and styling in generated UI
+
+### Key Components
+
+#### Registering a Frontend Tool
+
+Register tools that generate UI directly from their implementation:
+
+```csharp
+private void OnContextCreated(IAgentBoundaryContext context)
+{
+ var generateHaikuTool = AIFunctionFactory.Create(
+ (string[] japanese, string[] english, string? image_name, string? gradient) =>
+ GenerateHaiku(japanese, english, image_name, gradient),
+ "generate_haiku",
+ "Generate a haiku with Japanese text, English translation, and an optional image.");
+
+ context.RegisterTool(generateHaikuTool);
+}
+```
+
+#### Tool Implementation with UI Side Effects
+
+The tool implementation can directly update UI state:
+
+```csharp
+private Haiku GenerateHaiku(
+ string[] japanese,
+ string[] english,
+ string? image_name,
+ string? gradient)
+{
+ var newHaiku = new Haiku
+ {
+ Japanese = japanese ?? [],
+ English = english ?? [],
+ ImageName = image_name,
+ Gradient = gradient ?? string.Empty
+ };
+
+ // Update the carousel state directly
+ haikus.Insert(0, newHaiku);
+
+ // Trigger UI update
+ InvokeAsync(() =>
+ {
+ carouselRef?.ResetToFirst();
+ StateHasChanged();
+ });
+
+ return newHaiku;
+}
+```
+
+#### Rendering Tool Calls Inline
+
+Use a content template to render the tool call in the message stream:
+
+```csharp
+public class HaikuCallTemplate : ContentTemplateBase
+{
+ public override bool When(ContentContext context)
+ {
+ return context.Content is FunctionCallContent call &&
+ string.Equals(call.Name, "generate_haiku", StringComparison.OrdinalIgnoreCase);
+ }
+}
+```
+
+### Try It
+
+1. Click on **"Tool Based Generative UI"** in the sidebar
+2. Click **"Nature Haiku"** or ask for a haiku on any topic
+3. Watch as a beautifully styled haiku card appears with Japanese text, English translation, and a contextual image
+
+---
+
+## 6. Shared State
+
+The **Shared State** scenario demonstrates bidirectional state synchronization between the user interface and the AI agent. Users can edit a recipe form, and the AI can read and update that same state—enabling true collaborative experiences.
+
+
+
+### What It Shows
+
+- **UI-to-Agent State**: Sending current UI state to the agent via `DataContent`
+- **Agent-to-UI State**: Receiving state updates from the agent as snapshots
+- **Collaborative Editing**: Both user and agent can modify the same data
+- **Form-Based State**: Managing structured state with multiple fields
+
+### Key Components
+
+#### Sending State to the Agent
+
+Attach current state to messages using `DataContent`:
+
+```csharp
+private async Task ImproveWithAI()
+{
+ // Serialize current recipe state
+ var stateWrapper = new { recipe = currentRecipe };
+ byte[] stateBytes = JsonSerializer.SerializeToUtf8Bytes(stateWrapper);
+
+ // Create message with state attached as DataContent
+ var message = new ChatMessage(ChatRole.User,
+ [
+ new TextContent("Improve the recipe"),
+ new DataContent(stateBytes, "application/json")
+ ]);
+
+ await boundaryContext.SendAsync(message);
+}
+```
+
+#### Receiving State Updates
+
+Use `AgentState