Path: redb-route/redb.Route.Llm/Expressions/LlmExpressionContexts.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Llm/Expressions/LlmExpressionContexts.cs
----
using redb.Route.Llm.Providers;
namespace redb.Route.Llm.Expressions;
///
/// Snapshot of the current conversation visible to the
/// ${conversation.*} expression family. Set by
/// on the parent exchange under
/// the well-known key .
///
public sealed class LlmConversationContext
{
/// Conversation identifier (matches AgentRequest.ConversationId).
public string? Id { get; init; }
/// Number of messages in the transcript so far (includes the seeding user message).
public int MessageCount { get; init; }
/// Aggregate token usage across the current run.
public LlmUsage Tokens { get; init; } = LlmUsage.Empty;
/// Number of completed tool-loop iterations.
public int Iterations { get; init; }
/// Latest assistant message in the transcript (null before the first model response).
public LlmMessage? LastMessage { get; init; }
}
///
/// Snapshot of the tool currently being dispatched, visible to the
/// ${tool.*} expression family. Set by
/// on the parent exchange under
/// the well-known key .
///
public sealed class LlmToolContext
{
/// Tool name as declared in the tool_use block.
public string Name { get; init; } = string.Empty;
/// Provider-issued tool use id (correlates the call to its result block).
public string ToolUseId { get; init; } = string.Empty;
/// Raw JSON input passed to the tool.
public string InputJson { get; init; } = "{}";
/// Raw JSON output produced by the tool. Null while the tool is in flight.
public string? ResultJson { get; init; }
/// Wall-clock execution duration. while in flight.
public System.TimeSpan Duration { get; init; }
}
/// Well-known exchange property keys used by the LLM expression integration.
public static class LlmExpressionKeys
{
/// Exchange property holding the current .
public const string Conversation = "llm.conversation";
/// Exchange property holding the current .
public const string Tool = "llm.tool";
}