Skip to main content

Module effect

Module effect 

Source
Expand description

Serializable effect requests, handler descriptions, outcomes, and recording data. HandlerKey identifies a destination; EffectKind and Outcome describe the exchange. Host-defined operations use CustomEffect.

use rig_core::effect::{EffectFamily, EffectRow, model_key};

let mut row = EffectRow::new();
row.insert(model_key("primary"), EffectFamily::Completion);
assert_eq!(row.len(), 1);

Modules§

family
Type-level markers for built-in and host-defined effect families.

Structs§

Delivery
One delivery observed by a scheduled consumer. Entries are ordered by visibility, independently of dispatch ids and handler completion order.
EffectId
The identity of one dispatch, minted by the dispatcher.
EffectRecord
One recorded exchange: the effect, who served it, and the answer.
EffectRow
Required handler keys and their effect families, ordered by key. Self::is_subset_of validates the requirements against handler descriptors.
HandlerDescriptor
What a registered handler is: its key and its family-specific description.
HandlerKey
String identifier for a registered handler, serializable without a live handle.
Key
A handler key tagged with its effect family. Serializes as the underlying string without the family tag. Deserialization and Self::new_unchecked do not validate a registration; hosts must ensure the key serves F. Implements Send + Sync independently of F.
KeyParts
A key’s parts, by the grammar every key the tree mints follows:
RerankRequest
A reranking request: the query and documents a rerank model’s call orders.
RowGap
The first entry of a row a set of handlers does not serve: the key, the family the row needs, and what serves the key instead, if anything.
ToolCallRequest
A tool call as a typed request: the name and the raw JSON arguments. The context the tool runs with is not part of the request: it travels beside the dispatch, attached by the driver to the handler’s sink (Dispatch::scope::<ToolContext>()), and what the tool publishes comes back the same way (crate::tool::PublishedContext).
ToolEmbeddingDescriptor
The embedding context of a retrievable tool: what ToolEmbedding advertises, as data.

Enums§

DeliveryKind
What a scheduled consumer collected at one observation boundary.
EffectFamily
Effect classification used by typed binding and recording.
EffectKind
One effect: what a handler is asked to do.
EmbedInputs
The inputs of an embedding request: the texts or images an embedding model’s call embeds.
EmbedModality
Which modality an embedding handler serves.
EmbedOutputs
The answer to an EmbedInputs.
FamilyDescriptor
The family-keyed description of a handler. The variant is the family: binding a typed view compares Family::FAMILY against FamilyDescriptor::family.
MemoryOp
A conversation-memory operation: the transcription of ConversationMemory.
MemoryOutcome
The answer to a MemoryOp.
Outcome
What a handler answered.
RetrieveQuery
A retrieval: the transcription of VectorStoreIndex over the dynamic filter. The typed result parameter of top_n<T> stays on the client side.
RetrievedDocuments
The answer to a RetrieveQuery.
RowDiff
One difference between two rows.

Traits§

CustomEffect
A host’s own effect, typed the way a ToolContext value is: a declared kind label and a declared answer type, both serde. The wire form is EffectKind::Custom / Outcome::Custom; the type never crosses it.
Family
Sealed mapping between typed requests and answers and the wire’s EffectKind and Outcome. Hosts extend the protocol through CustomEffect and family::Custom, not new family implementations.
Served
Sealed handler-family declaration. Typed families expose Some(F::FAMILY); family::Dynamic exposes None and requires runtime family checks.

Functions§

embed_key
A key for an embedding handler: embed:<label>.
memory_key
A key for a labelled memory handler: memory:<label>. An agent’s own memory is registered under the bare memory key.
model_key
A key for a model handler: model:<label>.
rerank_key
A key for a rerank handler: rerank:<label>.
retrieve_key
A key for a labelled retrieval handler: retrieve:<label>. An agent’s own index is registered under the bare retrieve key.
tool_key
A key for a tool handler: tool:<name>.