Table of Contents

Class AgentStreamToken

Namespace
LMKit.Agents.Streaming
Assembly
LM-Kit.NET.dll

Represents a token or chunk in a streaming agent response.

public sealed class AgentStreamToken
Inheritance
AgentStreamToken
Inherited Members

Examples

Routing per-token output by type while streaming a single agent:

using LMKit.Agents.Streaming;

await foreach (AgentStreamToken t in agent.StreamAsync("Explain HTTP/3")) { if (t.Type == AgentStreamTokenType.Content) Console.Write(t.Text); }

Constructors

AgentStreamToken(string, AgentStreamTokenType, string, int, bool, IReadOnlyDictionary<string, object>)

Initializes a new instance of the AgentStreamToken class.

Properties

CumulativeText

Gets the cumulative text so far (including this token).

Index

Gets the index of this token in the stream (0-based).

IsFinal

Gets a value indicating whether this is the final token.

Metadata

Gets optional metadata about this token.

Text

Gets the text content of this token.

Type

Gets the type of this token.

Methods

Content(string, string, int, bool)

Creates a content token.

Error(string, int)

Creates an error token.

Status(string, int)

Creates a status update token.

Thinking(string, string, int)

Creates a thinking/reasoning token.

ToString()
ToolCall(string, string, int)

Creates a tool call token.

ToolResult(string, string, int)

Creates a tool result token.

Share