Skip to main content

Crate synaptic_middleware

Crate synaptic_middleware 

Source

Structs§

BaseChatModelCaller
Wraps a ChatModel into a ModelCaller.
ContextEditingMiddleware
Manages conversation context by trimming or filtering messages before each model invocation.
HumanInTheLoopMiddleware
Pauses tool execution to request human approval.
MiddlewareChain
A chain of middlewares that executes them in order.
ModelCallLimitMiddleware
Limits the number of model invocations during a single agent run.
ModelFallbackMiddleware
Falls back to alternative models when the primary model fails.
ModelRequest
A model invocation request visible to middleware.
ModelResponse
A model invocation response visible to middleware.
RuleBasedAnalyzer
Rule-based security analyzer that maps tool names and argument patterns to risk levels.
SecurityMiddleware
Middleware that assesses tool call risk and optionally requires confirmation.
SummarizationMiddleware
Automatically summarizes conversation history when it exceeds a token limit.
ThresholdConfirmationPolicy
Confirms tool calls that meet or exceed a risk threshold.
TodoListMiddleware
Adds task-planning capability to an agent by injecting a todo list into the system prompt.
ToolCallLimitMiddleware
Limits the number of tool invocations during a single agent run.
ToolCallRequest
A single tool call request visible to middleware.
ToolRetryMiddleware
Retries failed tool calls with configurable attempts and backoff.

Enums§

ContextStrategy
Strategy for editing context before model calls.
RiskLevel
Risk level for a tool call.

Traits§

AgentMiddleware
Middleware that can intercept and modify agent lifecycle events.
ApprovalCallback
A callback that decides whether a tool call should proceed.
ConfirmationPolicy
Determines whether a tool call at a given risk level requires confirmation.
ModelCaller
Trait representing the next step in the model call chain.
SecurityAnalyzer
Assesses the risk level of a tool call.
SecurityConfirmationCallback
Callback for obtaining user confirmation before executing a risky tool call.
ToolCaller
Trait representing the next step in the tool call chain.