Agentic

176 public types in this namespace, organized by kind.

Models & Types (112)

Type Summary
AgentExecutor<T> A single-model agent that drives an IChatClient in a native tool-calling loop: it calls the model, runs any tools the model requests, feeds the results back, and repeats until the model returns a final answer (or the iteration cap is hit)…
AgentMemory A single long-term memory: a piece of text the agent should be able to recall later, with a stable id and optional metadata.
AgentRunResult The outcome of an agent run: the final text answer, the full conversation transcript it produced, how many model calls it took, whether it finished cleanly, and the aggregate token usage.
AgentTrajectory A captured record of one agent run — the structured “trajectory” the self-improving layer learns from.
AiDotNetMeaiChatClient<T> Adapts an AiDotNet IChatClient to a IChatClient, so AiDotNet models (including the in-process LocalEngineChatClient and the first-party connectors) can be consumed by any code written against the .NET ecosystem’s standard chat abstrac…
AiToolDefinition Describes a tool/function the model is allowed to call: its name, a description, and a JSON-schema describing its parameters.
AllowedTokenSetConstraint A constraint that always restricts generation to a fixed set of token ids, regardless of context — for example, “only emit digit tokens” or “only emit tokens from this closed label vocabulary”.
AnthropicChatClient<T> An IChatClient for Anthropic’s Claude Messages API with native tool use, streaming, and multimodal (image) input.
ApprovalToolMiddleware An IToolMiddleware that gates tool execution behind an approval check — human-in-the-loop or policy-based tool authorization.
AzureOpenAIChatClient<T> An IChatClient for Azure OpenAI.
CachingEmbeddingClient Caches embedding vectors by content hash so a text already embedded costs nothing to embed again.
ChatClientEnsembleMember<T> One model in a weighted ensemble: the client, how often it is picked, and its own default settings.
ChatClientTrajectoryEvaluator<T> An ITrajectoryEvaluator that scores a run with a model acting as judge (“LLM-as-judge”): it shows a judging model the task and the agent’s answer (and an optional rubric) and parses a 0–1 score from the reply.
ChatMessage A single message in a chat conversation: a ChatRole plus one or more content parts.
ChatRequestContext The mutable request state flowing through a chat-middleware pipeline.
ChatResponse The complete result of a non-streaming chat call.
ChatResponseUpdate A single incremental update in a streaming chat response.
ChatUsage Token accounting for a chat request: how many tokens went in and came out.
CohereChatClient<T> An IChatClient for Cohere’s Chat API, whose bespoke wire format splits a turn into the latest message, a chat_history of prior turns, and a preamble for system instructions.
CollectingReasoningModelDiagnosticSink An in-memory IReasoningModelDiagnosticSink that keeps the most recent adjustments.
CompiledStateGraph<TState> An executable, validated state graph produced by Compile.
ContentSafetyMiddleware A guardrail IChatMiddleware that screens the user input before the model is called and/or the model’s response after, using an IContentModerator.
DelegateAgentTool An IAgentTool backed by an ordinary C# method (a delegate or a reflected method on an instance).
DelegateChatMiddleware An IChatMiddleware backed by a delegate — the quick way to add a one-off filter (logging, a header injection, a guard) without declaring a class.
DelegateToolMiddleware An IToolMiddleware backed by a delegate — the quick way to add a one-off tool filter (logging, argument fix-up, a guard) without declaring a class.
DelegateTrajectoryEvaluator An ITrajectoryEvaluator backed by a user-supplied scoring function — the general-purpose hook for custom rewards (exact-match against a labeled answer, regex/JSON validity, cost penalties, or any combination).
DenyListContentModerator A simple IContentModerator that blocks content containing any of a configured set of banned terms.
DeterministicEmbeddingClient A hashing embedding client that contacts nothing and returns the same vector for the same text forever.
EmbeddingAgentMemoryStore<T> A semantic IAgentMemoryStore that ranks memories by meaning, not words.
EmbeddingBatch The outcome of one embedding request: either every vector, or an explicit bounded failure.
EmbeddingVector An immutable, finite-valued embedding vector with a cached magnitude.
EvaluationReport Aggregate statistics from evaluating a set of trajectories: how many were scored, the reward distribution, and the fraction that met a pass threshold.
FineTuningDataset A set of reward-filtered FineTuningExamples ready to hand to a LoRA / fine-tuning trainer — the bridge from “the agent did well on these runs” to “make the local model better at them”.
FineTuningExample One supervised fine-tuning example distilled from a high-reward trajectory: the prompt the agent saw and the completion it produced that earned a good score.
FiniteStateTokenConstraint A constraint defined by a finite-state grammar over token ids: the set of allowed next tokens depends on the most recently generated token (the current state).
FunctionAgentTool An IAgentTool whose parameter schema is supplied up front and whose execution is a caller-provided delegate — i.e.
GeminiChatClient<T> An IChatClient for Google’s Gemini models via the generateContent API.
GgufFile A parsed GGUF file: its version, the metadata key/value store (hyperparameters, tokenizer config, etc.), the tensor directory, and access to F32/F16 tensor values.
GgufTensorInfo A tensor directory entry in a GGUF file: its name, dimensions, ggml data type, and byte offset within the tensor-data section.
GraphCheckpoint<TState> An immutable snapshot of a graph run at a point in time: which node runs next and the state as of that point.
GraphRunResult<TState> The outcome of a human-in-the-loop graph run: either the run completed, or it paused before an interrupt node awaiting input.
GraphStepUpdate<TState> A streamed update emitted after a single node finishes executing during a graph run: the node’s name and the graph state as it stands after that node.
GroundedVerifierAgent<T> Wraps an agent so the trained model grounds its answers: after the inner agent runs, any prediction it obtained from the model-prediction tool is recomputed authoritatively and checked against the numbers in the agent’s final answer.
GuardedAgentTool Wraps any IAgentTool with schema guardrails: before the inner tool runs, the model-supplied arguments are validated against the tool’s JSON Schema (required properties present, declared types match).
HttpMcpTransport An IMcpTransport that speaks JSON-RPC 2.0 to a remote MCP server over HTTP POST.
ImageContent An image content part within a ChatMessage, supplied either as raw bytes or as a URI.
InMemoryAgentMemoryStore A process-local IAgentMemoryStore that ranks memories by lexical overlap with the query — the fraction of the query’s words that appear in the memory.
InMemoryChatInteractionStore A process-local IChatInteractionStore holding recorded chat interactions in memory.
InMemoryConversationStore A process-local IConversationStore that keeps thread histories in memory.
InMemoryGraphCheckpointer<TState> An in-memory IGraphCheckpointer that keeps each thread’s checkpoint history in a dictionary.
InMemoryMcpTransport An IMcpTransport that forwards requests directly to an in-process McpServer — no serialization or network.
InMemoryTrajectoryStore A process-local ITrajectoryStore that keeps captured runs in memory.
JsonFileChatInteractionStore A durable, crash-safe IChatInteractionStore backed by one JSON file.
JsonFileConversationStore An IConversationStore that persists thread histories to a single JSON file, so conversations survive process restarts without an external database.
JsonFileGraphCheckpointer<TState> A durable IGraphCheckpointer that persists all threads’ checkpoints to a single JSON file, so runs survive process restarts.
LearnedAgentRouter<T> A router that learns, from graded AgentTrajectory history, which candidate agent performs best and routes new requests accordingly — a contextual reward-weighted bandit.
LearnedToolRouter Learns which tools tend to help for which kinds of request, so an agent can be biased toward tools that worked well on similar past requests instead of relying only on static tool descriptions.
LocalEngineChatClient<T> An IChatClient that runs entirely in-process over an ICausalLanguageModel — no network, no API key, no external service.
MambaCausalLanguageModel<T> A KV-cached IIncrementalCausalLanguageModel adapter over MambaLanguageModel.
ManualChatClient<T> An IChatClient that asks a person, by writing each prompt to a queue directory.
McpClient A Model Context Protocol (MCP) client: connects to an MCP server over an IMcpTransport, lists the tools it offers, and exposes them as IAgentTool instances the agent stack can call — so any MCP server’s capabilities become available to…
McpServer A Model Context Protocol (MCP) server that exposes a ToolCollection of AiDotNet tools to any MCP client (Claude Desktop, other agent frameworks, or AiDotNet’s own McpClient).
McpToolDescriptor Describes a tool advertised by an MCP server: its name, description, and JSON-Schema input contract — the data needed to surface it to a model as a callable tool.
MeaiChatClient<T> Adapts a IChatClient (the .NET ecosystem’s standard chat abstraction) to AiDotNet’s IChatClient, so any Microsoft.Extensions.AI connector (OpenAI, Azure, Ollama, etc.) can drive AiDotNet agents and reasoning.
MemoryAugmentedAgent<T> Wraps any IAgent with long-term memory recall: before each run it searches an IAgentMemoryStore for memories relevant to the latest user message and injects them as context, so the agent answers with knowledge gathered across previous c…
MiddlewareAgentTool An IAgentTool decorator that runs a chain of IToolMiddleware around an inner tool’s execution.
MiddlewareChatClient<T> An IChatClient decorator that runs a chain of IChatMiddleware around an inner client’s calls — the composition root for filters/middleware (logging, guardrails, caching, retry, telemetry).
MistralChatClient<T> An IChatClient for the Mistral platform, whose chat API is OpenAI-compatible.
ModelPredictionTool Exposes a trained model’s prediction as a callable agent tool, so an LLM agent can query the model you just trained mid-reasoning — the same way it would call web search or a calculator.
ModerationVerdict The verdict from moderating a piece of content: whether it is allowed, and if not, why.
NeuralNetworkCausalLanguageModel<T> Adapts a trained AiDotNet NeuralNetworkBase language model (e.g., MambaLanguageModel, GLALanguageModel, or a Transformer LM head) to the IIncrementalCausalLanguageModel and ILanguageModel seams, enabling KV-cached incremental gene…
OllamaChatClient<T> An IChatClient for a local Ollama server, which exposes an OpenAI-compatible chat-completions API.
OpenAIChatClient<T> An IChatClient for OpenAI’s Chat Completions API with native tool calling, streaming, structured output, and multimodal (image) input.
OpenAICompatibleEmbeddingClient An IEmbeddingClient for any provider that speaks the OpenAI /v1/embeddings wire format.
ProcessChatClient<T> An IChatClient that reaches a model by running a command-line program.
PromptEvalCase One labeled example in a prompt-optimization eval set: an input to send the agent and the expected answer to score its response against.
PromptOptimizationResult The outcome of prompt optimization: the best-scoring prompt plus the full ranked list of candidates.
PromptOptimizer<T> Selects the best system prompt for an agent by measuring candidate prompts against a labeled eval set — a DSPy-like, evaluation-driven prompt search.
ReasoningAzureOpenAIChatClient<T> An Azure OpenAI connector that applies the same reasoning-model request rules as ReasoningOpenAIChatClient.
ReasoningModelChatClient<T> Wraps any IChatClient and removes the per-request settings a reasoning model rejects, reporting each removal instead of dropping it in silence.
ReasoningModelDiagnostic One recorded edit a reasoning-model profile made to an outgoing chat request.
ReasoningModelDiagnosticSummary One distinct request adjustment together with how often it occurred.
ReasoningModelProfile Describes one family of reasoning models: how to recognise it, and how its requests differ.
ReasoningModelProfileRegistry An ordered set of reasoning-model profiles, resolved against a model id by prefix.
ReasoningOpenAIChatClient<T> An OpenAI Chat Completions connector that adapts its request body when the model is a reasoning model: it removes the sampling settings those models reject, sends the answer cap as max_completion_tokens, and attaches a reasoning_effort…
RecordingChatClient<T> An IChatClient decorator that calls a real inner client and records each request/response into an IChatInteractionStore.
ReplayingChatClient<T> An IChatClient that serves responses from a recorded IChatInteractionStore — deterministic replay without calling any model.
RetryChatMiddleware Retries transient chat failures with bounded exponential backoff, jitter, and a per-call timeout.
SafetensorsFile A parsed safetensors file: the tensor table of contents plus access to each tensor’s raw bytes and a conversion to Double values.
SafetensorsTensor Metadata for one tensor inside a safetensors file: its name, dtype, shape, and byte range within the data section.
ScoredMemory A memory paired with its relevance score for a particular query, as returned by SearchAsync.
ScoredPrompt A candidate prompt paired with its mean score over the eval set.
SoftmaxPolicyRouter<T> A routing policy over candidate agents, trained by REINFORCE: it keeps a learnable preference weight per agent (optionally per context), selects via a softmax over those weights, and updates them with a policy-gradient step from observed re…
StateGraph<TState> A builder for a typed state graph: register nodes (state transformers), wire them with fixed or conditional edges (cycles allowed), set an entry point, then Compile into an executable CompiledStateGraph.
StreamMcpTransport An IMcpTransport that speaks newline-delimited JSON-RPC 2.0 over a reader/writer pair — the framing MCP uses over stdio.
StreamingToolCallUpdate An incremental fragment of a tool call arriving over a streaming response.
SupervisorAgent<T> A coordinator agent that supervises a team of specialized worker IAgent instances and routes work to them via native tool-calling.
SwarmMember<T> One participant in a Swarm: a named persona with its own chat model, instructions, tools, and the set of peers it is allowed to hand control to.
Swarm<T> A peer-to-peer multi-agent team where control transfers between members over one shared conversation.
TelemetryChatMiddleware An IChatMiddleware that emits OpenTelemetry GenAI telemetry for each chat call: a client span tagged with the operation, response model, finish reason, and token usage, plus operation-count and token-usage metrics.
TextContent A plain-text content part within a ChatMessage.
ThreadedAgent<T> Wraps any IAgent with conversation memory: each run is tied to a thread id, so prior turns are loaded from an IConversationStore and prepended to the new input, and the new user/assistant turn is persisted afterwards.
TokenSampler<T> Selects the next token id from a logits vector according to LocalSamplingOptions: greedy (argmax) when temperature is zero, otherwise temperature-scaled softmax sampling restricted by optional top-k and top-p filters.
TokenizerGenerationAdapter Bridges a full repo ITokenizer to the engine’s minimal IGenerationTokenizer seam, so any AiDotNet tokenizer can drive LocalEngineChatClient.
ToolCallContent A request, emitted by the assistant, to invoke a named tool/function with JSON arguments.
ToolCollection A named set of executable tools: registers IAgentTool instances, exposes their AiToolDefinitions for a chat request, and dispatches model tool-calls to the right tool.
ToolInvocationContext The mutable state flowing through a tool-invocation middleware pipeline: which tool is being called, the (rewritable) arguments, and a shared property bag.
ToolInvocationResult The outcome of executing an IAgentTool: the text fed back to the model plus a flag indicating whether the tool failed.
ToolResultContent The result of executing a tool, fed back to the model to continue a tool-calling turn.
TracingAgent<T> Wraps any IAgent and records each run as an AgentTrajectory in a ITrajectoryStore, without altering the agent’s behavior.
TrajectoryEvaluationRunner Runs an ITrajectoryEvaluator over trajectories, annotating each with its Reward and producing an aggregate EvaluationReport.
WeightedEnsembleChatClient<T> Routes each chat call to one of several models, chosen by weight from a reproducible random stream.

Base Classes (3)

Type Summary
AgentToolBase Base class for tools that implements the common metadata plumbing, leaving only the behavior (InvokeCoreAsync) for subclasses.
AiContent Base type for a single piece of content inside a ChatMessage.
ChatClientBase<T> Base class for IChatClient implementations that talk to an HTTP chat API.

Interfaces (19)

Type Summary
IAgentMemoryStore A long-term, cross-thread memory store: it remembers facts and can retrieve the ones most relevant to a query.
IAgentTool An executable tool the model can call: a name, a description, a JSON-schema for its arguments, and an asynchronous invocation entry point.
IAgent<T> A named, runnable agent: given a conversation, it produces a final answer (after optionally using tools and/or delegating to other agents along the way).
ICausalLanguageModel<T> The minimal contract an in-process language model exposes to the local generation engine: given the tokens seen so far, produce the logits for the next token.
IChatClient<T> A message-based chat model client that supports native tool calling, streaming, and structured output.
IChatInteractionStore Stores recorded chat interactions (request key → response) so model calls can be deterministically replayed later without invoking any model.
IChatMiddleware A cross-cutting filter around chat-model calls (the AiDotNet analogue of Semantic Kernel filters / a middleware pipeline).
IChatPromptTemplate Renders a chat conversation (a list of ChatMessage) into the single prompt string a local language model is fed.
IContentModerator Checks whether a piece of text is safe/allowed — the seam guardrails use to screen agent inputs and outputs.
IConversationStore Persists multi-turn conversations keyed by a thread id, so an agent can remember earlier turns across separate runs.
IGenerationTokenizer The minimal tokenizer contract the local generation engine needs: turn text into token ids, turn token ids back into text, and know which token marks end-of-sequence.
IGraphCheckpointer<TState> Persists and retrieves GraphCheckpoints, enabling durable resume and time-travel for graph runs.
IIncrementalCausalLanguageModel<T> An ICausalLanguageModel that supports incremental (KV-cached) decoding: it processes the prompt once, caches the per-position state, and then advances one token at a time without recomputing the whole sequence.
IMcpTransport Carries Model Context Protocol (MCP) JSON-RPC requests to a server and returns the result.
INamedTensorSource A source of named weight tensors readable as Double arrays — the common surface over the safetensors and GGUF readers that WeightImporter imports from.
ITokenConstraint Restricts which tokens the local engine may generate next, enabling constrained decoding: the model can only emit tokens the constraint permits, so the output is guaranteed to satisfy a structure (a fixed vocabulary, a grammar, a JSON sha…
IToolMiddleware A cross-cutting filter around tool/function execution (the AiDotNet analogue of Semantic Kernel’s function-invocation filter).
ITrajectoryEvaluator Scores a captured AgentTrajectory, producing the reward signal the self-improving layer optimizes against (higher is better).
ITrajectoryStore Stores captured AgentTrajectory records so the self-improving layer can replay, evaluate, and learn from past agent runs.

Enums (5)

Type Summary
ChatFinishReason Describes why a chat model stopped generating a response.
ChatResponseFormatKind Selects the shape the model’s output must take (free text, arbitrary JSON, or schema-constrained JSON).
ChatRole Identifies who authored a ChatMessage in a conversation.
ImageMediaType The image formats accepted by multimodal chat models.
ToolChoiceMode Controls whether and how a chat model is allowed to call tools on a given request.

Delegates (2)

Type Summary
ChatPipelineDelegate The delegate that invokes the next stage of a chat-middleware pipeline (ultimately the model call).
ToolPipelineDelegate The delegate that invokes the next stage of a tool-invocation pipeline (ultimately the tool itself).

Options & Configuration (9)

Type Summary
AgentExecutorOptions Settings for an AgentExecutor: identity, system prompt, the tool-loop budget, and the sampling knobs forwarded to each model call.
ChatOptions Per-request settings for a chat call: sampling controls, tool availability, and output format.
ContentSafetyOptions Settings for ContentSafetyMiddleware: which sides to screen, what to say when blocking, and whether a violation throws or returns a refusal.
GraphRunOptions Per-run settings for executing a CompiledStateGraph.
LocalEngineOptions Settings for LocalEngineChatClient: the reported model id, the default generation length, and the default sampling behavior (overridable per request via ChatOptions).
LocalSamplingOptions Controls how the next token is chosen from the model’s logits: temperature, top-k, top-p (nucleus), and an optional seed for reproducibility.
MemoryAugmentationOptions Settings for MemoryAugmentedAgent: how many memories to recall, the minimum relevance to include, and the heading used when injecting them into the conversation.
SupervisorOptions Settings for a SupervisorAgent: its identity, an optional override of the routing system prompt, and the coordinator’s loop/sampling budget.
SwarmOptions Settings for a Swarm: its identity and the overall step budget shared across all members for a single run.

Helpers & Utilities (20)

Type Summary
AgentGraphNodeExtensions Bridges the agents layer and the graph runtime: adds an IAgent as a node in a StateGraph.
AgentToolFactory Creates IAgentTool instances from delegates or from objects whose methods are annotated with AgentToolAttribute.
AgenticTelemetry The instrumentation source for the agentic subsystem: a named ActivitySource (traces) and Meter (metrics) following OpenTelemetry GenAI semantic conventions.
ChatClientExtensions Convenience helpers over IChatClient for the common “prompt in, text out” case.
ChatClientPipelineFactory Assembles a chat client and its surrounding policy — defaults, retry, telemetry, filters, recording.
ChatOptionsMerge Layers chat settings so a specific setting wins over a general one, field by field.
FineTuningDataConverter Bridges the self-improving layer to the fine-tuning framework: converts a reward-filtered FineTuningDataset (prompt → good-completion pairs) into the framework’s supervised FineTuningData shape so it can be handed to `SupervisedFineTuni…
GgufReader Parses the GGUF weight format (used by llama.cpp and the wider GGML ecosystem) into a GgufFile: the header, the metadata key/value store, and the tensor directory.
GraphSpecialNodes Reserved node names recognized by the graph runtime.
ImageMediaTypeExtensions Conversions between ImageMediaType and its wire-format MIME string.
JsonSchemaGenerator Generates JSON Schema (the dialect chat models consume for tool parameters and structured output) from .NET types and method parameters using reflection.
LlmJsonExtractor Pulls the JSON object out of a model reply that may wrap it in prose or a code fence.
LoRAFineTuner Runs the online self-improvement loop’s final step: fine-tune (e.g.
MeaiChatClientExtensions Fluent bridges between AiDotNet’s IChatClient and Microsoft.Extensions.AI’s IChatClient, in both directions, with full tool-calling support.
ReasoningEffortLevelExtensions Converts a ReasoningEffortLevel to and from the value providers use on the wire.
RewardFilteredDatasetBuilder Builds a FineTuningDataset from captured trajectories by keeping only those whose reward meets a threshold and turning each into a (prompt, completion) pair — reward-filtered behavior cloning, the data-preparation half of online LoRA self…
SafetensorsReader Parses the safetensors weight format — the safe, simple format used to distribute pretrained model weights — into a SafetensorsFile.
StructuredOutputExtensions Helpers that turn a chat model’s reply into a strongly-typed .NET object by constraining the model to a JSON schema derived from the target type and deserializing the result.
TextTensorDatasetConverter Tokenizes a text FineTuningDataset into tensor supervised-fine-tuning data so a tensor model (e.g.
WeightImporter Imports named weight tensors from an INamedTensorSource (safetensors or GGUF) into an AiDotNet network’s flat parameter vector.

Attributes (2)

Type Summary
AgentToolAttribute Marks a method as an agent tool so it can be discovered and exposed to a model with an auto-generated JSON schema.
ToolParameterAttribute Adds a description (and optional required-override) to a tool method parameter, enriching the auto-generated JSON schema.

Exceptions (4)

Type Summary
ContentSafetyException Thrown by ContentSafetyMiddleware when content is blocked and the middleware is configured to fail hard (ThrowOnViolation) rather than return a refusal.
GraphRecursionException Thrown when a graph run exceeds its configured maximum number of steps, which usually indicates a cycle that never reaches the end node.
HttpResponseException An HttpRequestException that preserves the HTTP status code of a non-success API response on every target framework.
McpException Thrown when an MCP server returns a JSON-RPC error or a malformed response.