DRYL COMPONENTS
Color mode: System — switch to light
2.20.1
Agents

Agent Run

AI-aware

The foundation every other Agents feature builds on. You bring an AIAgent; Runner.Start hands you a DrylAgentRun — an observable handle over the whole answer lifecycle — and the UI derives itself from it.

How it works

An AI answer isn't one event — it's a lifecycle: thinking, streaming tokens, calling tools, then settling. A DrylAgentRun exposes that lifecycle as a live AiState and a token stream. Drop it into a DrylAiScope and every AI-aware component inside switches Thinking → Streaming → Generated in lockstep; tool calls surface through DrylAgentToolCalls.

Where the innovation lies: the run is the single source of truth and the UI is derived, not orchestrated. No isLoading booleans, no manual state machine, no glue between the model and the interface.

csharp
// Bring your own AIAgent + session — Runner.Start returns an observable DrylAgentRun.
var run = Runner.Start(agent, session, "How does DrylAiScope work?", aiKey: "answer");
razor
<DrylAiScope Key="answer">
    <DrylCard Ai="@run.State">
        <DrylAgentToolCalls Run="run" />
        <DrylAiStream Source="run.TextStream" Key="answer">
            <DrylMarkdown Content="@context.Text" Ai="@context.State" />
        </DrylAiStream>
    </DrylCard>
</DrylAiScope>

Agent run → automatic AiState + tool calls

Start a run and wrap it in a DrylAiScope: every AI-aware component inside switches Thinking → Streaming → Generated in lockstep. Tool calls surface through DrylAgentToolCalls — no manual state anywhere.

An unhandled error has occurred. Reload x

Reconnecting to the server…

Attempt /

Next try in s