Table of Contents

Namespace Emissary

Classes

AgentCompactedEvent

Older messages were summarized to keep the conversation inside the context window (see CompactionOptions).

AgentCompletedEvent

The run ended. Always the final event of a stream.

AgentEvent

One event in a streaming agent run.

AgentHandoffEvent

A conversation was transferred to another agent.

AgentOptions

Configuration for a ClaudeAgent.

AgentResult

The outcome of an agent run.

AgentSuspendedEvent

The run paused at a human-in-the-loop gate. Persist the suspension and resume later with ResumeAsync(SuspendedRun, bool, CancellationToken). Followed by the final AgentCompletedEvent.

AgentTextEvent

A fragment of assistant text as it streams.

AgentThinkingEvent

A fragment of the model's thinking as it streams.

AgentToolCallEvent

The model started calling a tool.

AgentToolFailedEvent

A tool handler threw and the failure was reported to the model (ReportToModel). Carries the exception in full, whatever the model was told — see IncludeExceptionMessage.

AgentToolResultEvent

A tool finished executing.

AgentTurnEvent

One model turn completed and was appended to the conversation.

AgentUsage

Token usage accumulated across all turns of a run.

AuthorizeToolAttribute

Requires a policy for a ClaudeToolAttribute method. Tools whose policy the configured IToolAuthorizer does not grant are filtered out before prompt construction — the model never sees their schemas — and cannot be executed. With no authorizer configured, policy-gated tools are denied by default.

ClaudeAgent

The agent loop: sends the conversation to Claude, streams the response, executes requested tools (in parallel), feeds results back, and repeats until the model finishes or a limit hits.

ClaudeSchemaAttribute

Marks a partial record or class as a structured-output type. The Emissary source generator adds a public static string JsonSchema property containing the strict JSON Schema ("additionalProperties": false on every object level), built at compile time.

ClaudeToolAttribute

Marks a static method as a Claude tool. The Emissary source generator turns it into a ToolDefinition exposed as a generated {MethodName}Tool property on the containing type — with a compile-time JSON Schema and a reflection-free dispatcher.

CompactionOptions

Client-side context compaction: when a turn's input grows past TriggerInputTokens, Emissary summarizes the older part of the conversation and replaces it with that summary, so long-running agents survive past the context window.

CompensationResult

The outcome of one saga compensation performed by CompensateAsync(AgentResult, CancellationToken).

ContentBlock

One block of message content — text, thinking, a tool call, or a tool result.

Conversation

An immutable conversation: appending returns a new instance, so any point in an agent run can be kept, compared, or replayed without defensive copies.

ConversationSession

A durable, resumable chat session: ties a ClaudeAgent to an IConversationStore by conversation id. Each turn loads the stored history, runs the agent, and persists the updated conversation — so a chatbot can resume by id across requests or restarts.

CostEstimator

Computes the monetary cost of agent runs from token usage and a registered price table. Cache reads and writes are billed at their own rates, so a cache-heavy run costs far less than its raw input-token count suggests.

EmissaryDefaults

Project-wide defaults.

EmissaryServiceCollectionExtensions

Dependency-injection registration for Emissary.

EmissaryTelemetry

The names to subscribe to for Emissary's traces and metrics.

GuardSnapshot

Serializable snapshot of the tool-call guard for durable suspension.

HandoffTarget

Another agent this agent may transfer a conversation to. Unlike AsTool(string, string) — where a sub-agent answers a question and control returns — a handoff passes the whole conversation on: the target continues it with its own system prompt, tools, and contracts, and produces the final answer.

InMemoryAgentStateStore

Process-local IAgentStateStore — suitable for tests and single-node apps.

InMemoryConversationStore

Process-local IConversationStore — suitable for tests and single-node apps.

Message

One immutable message in a conversation.

ModelPricing

Per-million-token prices for a model, in any currency (typically USD). Supply the rates from your Anthropic contract — Emissary ships no hardcoded prices, since they change over time.

PersistedConversation

The serializable shape of a Conversation.

PlannedEffect

One privileged tool call intercepted by Shadow: what the agent would have done. Review the plan, then re-run live to commit.

PolicyToolAuthorizer

An IToolAuthorizer backed by a fixed set of granted policy names.

RedactedThinkingBlock

Thinking withheld by the platform; must round-trip unmodified.

ResilienceOptions

Controls how transient failures talking to the Claude API are handled: retries with exponential backoff, and an optional per-attempt timeout. Retries happen only before the first streamed event of a turn — once output has started, the stream is never re-issued.

SuspendedRun

A durably suspended agent run, paused at a human-in-the-loop gate. Serialize with ToJson(), persist (e.g. via IAgentStateStore), and resume later — minutes or days — with ResumeAsync(SuspendedRun, bool, CancellationToken).

TextBlock

Plain text content.

ThinkingBlock

Claude's internal reasoning. The signature must round-trip unmodified.

ToolArgumentException

Thrown by generated tool dispatchers when the model supplies invalid tool input — a required argument is missing, or a value cannot be converted to the parameter type.

ToolDefinition

A fully materialized tool: wire name, description, compile-time JSON Schema, and a reflection-free dispatcher. Instances are normally produced by the Emissary source generator from ClaudeToolAttribute-annotated methods, but can be built by hand.

ToolFailure

A tool handler that threw during a run.

ToolFailureOptions

How tool failures and slow tools are handled.

ToolResultBlock

The result of a tool invocation, sent back to the model.

ToolRules

Declarative constraints on tool-call behavior, enforced by the agent loop at runtime. A violating call is not executed; the model receives an error tool result explaining the contract and can self-correct.

ToolUseBlock

A tool invocation requested by the model.

Trajectory

A recorded agent run: every model request and response, replayable deterministically and serializable as a .trajectory JSON file. Record with TrajectoryRecorder, replay by constructing a ClaudeAgent with the trajectory.

TrajectoryDivergenceException

Thrown when a replayed agent run diverges from its trajectory — the agent made a different request (or more requests) than were recorded.

TrajectoryRecorder

Collects the turns of a live agent run. Pass one to the ClaudeAgent(AgentOptions, TrajectoryRecorder) constructor, run the agent, then call ToTrajectory() to snapshot the recording.

TrajectoryRequest

The recorded shape of one model request.

TrajectoryResponse

The recorded shape of one model response.

TrajectoryTurn

One recorded model call.

WebSearchOptions

Enables Claude's server-side web search for a run. Unlike [ClaudeTool] tools, web search executes on Anthropic's servers within a single turn — Emissary does not dispatch it.

Structs

ConversationId

Strongly typed identifier for a single agent conversation.

Interfaces

IAgentStateStore

Persists suspended runs between the suspension and the (possibly much later) approval. Implementations decide durability: in-memory, database, blob storage.

IClaudeSchema

Implemented automatically by ClaudeSchemaAttribute types: exposes the compile-time strict JSON Schema generically, enabling WithOutput<T>().

IConversationStore

Persists ongoing conversations so a chat can be resumed by id across requests or process restarts. Distinct from IAgentStateStore, which persists runs paused at a human-in-the-loop gate.

IToolAuthorizer

Decides which policy-gated tools the current caller may use. Evaluated once per agent: unauthorized tools are removed before prompt construction and cannot be executed. Implementations typically capture the acting principal (user delegation or service identity).

Enums

AgentStopReason

Why an agent run ended.

EffortLevel

The effort budget for a response.

ExecutionMode

How tool effects are executed.

MessageRole

Who authored a message.

PromptCacheMode

How Emissary manages prompt caching.

ThinkingMode

How Claude's extended thinking is configured.

ToolFailureMode

What happens when a tool handler throws.

ToolReplayMode

Whether a replayed run executes its tools or serves their recorded results.