Expand description
klieo — open-source Rust agent framework.
This umbrella crate re-exports klieo_core unconditionally and
exposes each implementation crate behind a Cargo feature flag so
users can start with just the trait surfaces and opt into concrete
implementations one at a time.
§Quickstart
Add to Cargo.toml:
[dependencies]
klieo = { version = "1", features = ["all-foundation"] }Then build an agent:
use klieo::{RunOptions, Error};
let opts = RunOptions::default();
let _ = opts;§Feature flags
§Foundation
| Feature | Crate enabled |
|---|---|
| (none) | klieo-core trait surfaces only |
tools | klieo-tools — ChainedInvoker, schema validation |
macros | klieo-macros — #[tool] proc-macro |
llm-ollama | klieo-llm-ollama — Ollama HTTP client |
memory-sqlite | klieo-memory-sqlite — SQLite-backed memory |
bus-memory | klieo-bus-memory — in-process bus |
bus-nats | klieo-bus-nats — NATS JetStream bus |
mcp | klieo-tools-mcp — MCP adapter (implies tools) |
all-foundation | All foundation features above |
§LLM providers
| Feature | Crate enabled |
|---|---|
llm-openai | klieo-llm-openai |
llm-anthropic | klieo-llm-anthropic |
llm-gemini | klieo-llm-gemini (Google Gemini) |
all-llm | All LLM providers (incl. Ollama) |
§Memory backends
| Feature | Crate enabled |
|---|---|
memory-neo4j | klieo-memory-neo4j |
memory-qdrant | klieo-memory-qdrant |
embed-common | klieo-embed-common — shared Embedder trait |
memory-fastembed | memory-sqlite + real CPU embeddings |
memory-sqlite-vec | memory-sqlite + k-NN sqlite-vec index |
all-memory | All memory backends (incl. GraphRAG cluster) |
§GraphRAG cluster
Stable at 1.x per ADR-039.
| Feature | Crate enabled |
|---|---|
memory-graph | klieo-memory-graph — KnowledgeGraph trait + InMemoryGraph |
memory-graph-neo4j | klieo-memory-graph-neo4j — Neo4j-backed KnowledgeGraph (implies memory-graph + memory-neo4j) |
memory-graph-rag | klieo-memory-graph-rag — graph-first RAG composer (implies memory-graph + memory-qdrant) |
graph-projector | klieo-graph-projector — Episode→Graph projector (implies memory-graph) |
§Composition + protocol
| Feature | Crate enabled |
|---|---|
flows | klieo-flows — Sequential/Parallel/Loop/Graph |
workflow | klieo-workflow — declarative no-code workflow substrate |
a2a | klieo-a2a — durable Agent-to-Agent v1.0 |
spec | klieo-spec — quality-loop runner |
hitl | klieo-hitl — human-in-the-loop review gate |
§Observability + provenance
| Feature | Crate enabled |
|---|---|
runlog | klieo-runlog — RunLog projection + replay |
runlog-sqlite | runlog + SQLite store |
runlog-compaction-llm | runlog + LLM-summarise compaction |
provenance | klieo-provenance — Merkle hash chain |
otel | klieo-otel — OpenTelemetry OTLP exporter |
all-observability | runlog + provenance + otel |
§Aggregates
| Feature | Enables |
|---|---|
full | Every impl crate — heavy build, for integration tests |
test-utils | klieo-core/test-utils for downstream test deps |
Re-exports§
pub use app::App;pub use app::AppBuilder;pub use recall_recorder::RecallRecorder;pub use graph_rag::ExtractorMode;pub use graph_rag::GraphRagConfig;pub use bytes;
Modules§
- a2a
- Durable Agent-to-Agent v1.0 protocol layer.
- agent
- Re-exports every public item from
klieo-core.Agenttrait andAgentContext. - app
- Fluent assembler that collapses the 13-field
AgentContextinto a one-call wiring surface. SeeAppfor the entry point.App— fluent assembler that collapses the 13-fieldAgentContextinto a one-call wiring surface. - auth_
oauth - OAuth 2.0 bearer-token Authenticator for klieo HTTP transports.
- bus
- Re-exports every public item from
klieo-core. Inter-agent bus traits — Pubsub, RequestReply, KvStore, JobQueue. - bus_
memory - In-process bus:
bus_memory::MemoryBus. - bus_
nats - NATS JetStream bus:
bus_nats::NatsBus,bus_nats::NatsBusConfig. - cancel
- Re-exports every public item from
klieo-core. Per-replica registry of in-flight cancellation tokens. - checkpoint
- Re-exports every public item from
klieo-core. Durable continuation state for a suspended run (ADR-045). - embed_
common - Shared
Embeddertrait + dummy/fake impls. - error
- Re-exports every public item from
klieo-core. Error types used acrossklieo-core. - eval
- Recall-quality metrics —
hit_rate, MRR,precision@k,recall@k,NDCG@k— for klieo memory pipelines. - flows
- Multi-agent composition shapes:
Sequential/Parallel/Loop/Graph. - graph_
projector - Episode-to-knowledge-graph projector bridge.
- graph_
rag - One-line GraphRAG facade configuration —
graph_rag::GraphRagConfig. - guardrail
- Re-exports every public item from
klieo-core. Pre/post-LLM validation hooks for refuse + handoff workflows. - hitl
- Durable human-in-the-loop run driver — suspend a run for operator approval, resume on decision (ADR-045).
- ids
- Re-exports every public item from
klieo-core. Strongly-typed IDs used throughout the framework. - leader
- Re-exports every public item from
klieo-core. Per-replica leader claim + liveness probe for orphan detection. - llm
- Ollama LLM client:
llm::OllamaClient. - llm_
anthropic - Anthropic Messages client.
- llm_
gemini - Google Gemini client.
- llm_
openai - OpenAI Chat Completions client.
- macros
- Procedural macros: the
#[macros::tool]attribute. - mcp
- MCP adapter:
mcp::McpToolset,mcp::StdioConnectOptions. - mcp_
server - MCP server: publish this process’s tools to MCP clients via
mcp_server::McpServer. Pairs withApp::serve_mcp_stdio. - memory
- Re-exports every public item from
klieo-core. Memory traits — short-term, long-term, episodic. - memory_
graph - GraphRAG trait surface —
KnowledgeGraph,FilterableLongTermMemory,EntityExtractor,EntityRef,EntityType,RecallMetrics,InMemoryGraph,known_epoch. - memory_
graph_ neo4j - Neo4j-backed
KnowledgeGraphimpl:Neo4jKnowledgeGraph,ScopedQuery. - memory_
graph_ rag - Graph-first RAG composer:
GraphAwareLongTerm+ extractors +KnowledgeIngestionPipeline+ImportSource. - memory_
neo4j - Neo4j-backed memory: short-term + episodic.
- memory_
qdrant - Qdrant-backed long-term memory (vector recall).
- memory_
sqlite - SQLite-backed memory:
memory_sqlite::MemorySqlite,memory_sqlite::DummyEmbedder. - observability
- Re-exports every public item from
klieo-core. Cluster-0.23 observability primitives — PII-safe principal hashing + helpers for span attribute construction. - otel
- OpenTelemetry OTLP exporter wired to
tracingspans. - prelude
- Common imports for klieo agent authors.
- profile
- Re-exports every public item from
klieo-core. Deployment posture profiles that bundle several fail-open guards into a single fail-closed opt-in. See ADR-022 (tenant binding). - provenance
- Append-only Merkle hash chain + signed evidence bundles.
- rate_
limit - Re-exports every public item from
klieo-core. Client-side token-bucket rate limiter for anyLlmClient. - reaper
- Re-exports every public item from
klieo-core. Background task that periodically evicts orphaned entries from cluster-0.20’sklieo-leadersand cluster-0.22’sklieo-tenantsKV buckets. - recall_
recorder - Recall-recording wrapper that redacts and length-bounds GraphRAG
recall queries before they reach durable episodic storage. See
RecallRecorderfor the entry point. Recall-recording wrapper forLongTermMemory. - redact
- Re-exports every public item from
klieo-core. Audit-redaction port and the fail-closed opaque-digest fallback. - response
- Re-exports every public item from
klieo-core. Typed structured-output trait + parser. - resume
- Re-exports every public item from
klieo-core. Per-stream SSE event buffer used by HTTP/SSE transports for resumption viaLast-Event-ID/klieo/tools/resume. - runlog
- Tier 2 observability — RunLog projection + replay engine.
- runtime
- Re-exports every public item from
klieo-core. Runtime loop driving ancrate::agent::Agentthrough LLM ↔ tool exchanges. - server_
outbound - Re-exports every public item from
klieo-core. Server-initiated outbound JSON-RPC primitive — transport-agnostic. - spec
- Generic decompose / critique / refine traits +
QualityLooprunner. - summarize
- Re-exports every public item from
klieo-core. Rolling LLM-summary checkpoint for bounding conversation context cost. - tenants
- Re-exports every public item from
klieo-core. Per-stream ownership claim backed by a dedicated KV bucket. - test_
utils - Re-exported
klieo_core::test_utils(in-memory fakes for the memory traits, fake LLM client, fake tool invoker). - tool
- Re-exports every public item from
klieo-core. Tool trait, invoker, and tool context. - tools
- Tool dispatch:
tools::ChainedInvoker,tools::validate_args. - viz
- Embeddable agent-flow visualizer — mount
viz::VizRouterBuilder::buildin your app’saxumserver over your ownEpisodicMemory/RunLogStoreto see runs, the cross-run flow canvas, per-step detail + cost, and live updates. - workflow
- Declarative no-code workflow substrate: lower a
WorkflowDef(authored as data) into a runnable flow viaworkflow::compile.
Structs§
- AckHandle
- Re-exports every public item from
klieo-core. Acknowledgement handle attached to a deliveredMsg. - Agent
Context - Re-exports every public item from
klieo-core. Borrow-free agent execution context. HoldsArc<dyn …>so it can be cloned freely acrosstokio::spawnboundaries ('staticrequirement). - Agent
Context Builder - Re-exports every public item from
klieo-core. Fluent builder forAgentContext. - BusHandles
- Re-exports every public item from
klieo-core. Resolved bundle of bus handles ready to drop into ancrate::agent::AgentContextor anApp. - Cancel
Registry - Re-exports every public item from
klieo-core. Per-replica registry mapping in-flight stream ids to theirCancellationToken. Cloning the registry yields a handle that shares the same underlying map, so the wildcard cancel-subject subscription task and the invoke-handling task can both hold one. - Capabilities
- Re-exports every public item from
klieo-core. Provider capability declaration. - Capabilities
Builder - Re-exports every public item from
klieo-core. Fluent builder forCapabilities. Build viaCapabilities::builder. - Chat
Chunk - Re-exports every public item from
klieo-core. One chunk of a streaming response. - Chat
Request - Re-exports every public item from
klieo-core. Chat completion request. - Chat
Response - Re-exports every public item from
klieo-core. Chat completion response. - Checkpoint
GcHandle - Re-exports every public item from
klieo-core. Handle for the spawned checkpoint-GC task; itsDropaborts the task. - Claim
Handle - Re-exports every public item from
klieo-core. Handle the impl uses to resolve a claim. - Claimed
Job - Re-exports every public item from
klieo-core. Job claimed by a worker. - Durable
Name - Re-exports every public item from
klieo-core. Durable consumer name for a JetStream-style subscription. - Fact
- Re-exports every public item from
klieo-core. One stored fact in long-term memory. - FactId
- Re-exports every public item from
klieo-core. Identifier for a stored fact inLongTermMemory. - Job
- Re-exports every public item from
klieo-core. Job enqueued for durable processing. - JobId
- Re-exports every public item from
klieo-core. Identifier for an enqueued job inJobQueue. - KeyPage
- Re-exports every public item from
klieo-core. One page of bucket keys plus an opaque cursor for the next page. - KvEntry
- Re-exports every public item from
klieo-core. One KV entry. - KvReaper
Handle - Re-exports every public item from
klieo-core. Per-server reaper handle. Drop aborts the scan task. - Leader
Entry - Re-exports every public item from
klieo-core. Persisted leader claim envelope. - Leader
Handle - Re-exports every public item from
klieo-core. Drop-guard for a leader claim. Aborts the internal heartbeat task + spawns a best-effort delete of the KV key. Operators that need synchronous cleanup should drop early and let the spawned delete settle (a few KV round-trips at most). - Leader
Registry - Re-exports every public item from
klieo-core. Per-replica leader claim handle. Backed by aKvStorebucket dedicated to leader entries; both transports share one bucket keyed by{kind}.{id}(e.g.a2a.t-1,mcp.tok-1). - Lease
- Re-exports every public item from
klieo-core. Lease handle. Heartbeat to extend; drop to release. - MaxResponse
Length Guardrail - Re-exports every public item from
klieo-core. Refuses if the assistant response content is longer thanmax_charscharacters. - Memory
Handles - Re-exports every public item from
klieo-core. Resolved trio of memory handles ready to drop into ancrate::agent::AgentContextor anApp. - Message
- Re-exports every public item from
klieo-core. One message in a chat conversation. - Msg
- Re-exports every public item from
klieo-core. One message delivered to a subscriber. - Neo4j
Config - Neo4j connection config for
GraphRagConfig::remote, re-exported so callers configure the remote backend throughklieowithout taking a direct dependency on theklieo-memory-neo4jadapter crate. Configuration forMemoryNeo4j. - Never
Review - Re-exports every public item from
klieo-core. The additive default: existingRunOptionscallers keep their prior non-pausing behaviour without opting into HITL. - Ownership
Handle - Re-exports every public item from
klieo-core. Drop-guard for an ownership claim. Spawns a best-effortkv.deleteon Drop; runtime guard mirrorscrate::LeaderHandlefrom cluster 0.20 — degrades to warn-log when no tokio runtime is active during Drop (synchronous shutdown paths). - Ownership
Registry - Re-exports every public item from
klieo-core. Per-replica ownership registry. Stores{stream_id} -> principalmappings in a dedicated KV bucket (typicallyklieo-tenants). - Qdrant
Config - Qdrant connection config — re-exported at the crate root so callers
configuring
AppBuilder::qdrant_withreach it asklieo::QdrantConfigwithout a direct dependency on theklieo-memory-qdrantadapter crate. - Refusal
Keyword Guardrail - Re-exports every public item from
klieo-core. Refuses if any deny-keyword (case-insensitive) appears in the outgoing user message or the assistant response content. - RunCheckpoint
- Re-exports every public item from
klieo-core. Minimal state required to resume a suspended run. Excludes theAgent(itsArc<dyn _>ports are not serializable) — only the conversation and the tool calls awaiting approval are captured. - RunFilter
- Re-exports every public item from
klieo-core. Filter passed toEpisodicMemory::list_runs. - RunId
- Re-exports every public item from
klieo-core. Unique identifier for a single agent run. - RunOptions
- Re-exports every public item from
klieo-core. Tunables forsuper::run_stepsandsuper::run_steps_streaming. - RunSummary
- Re-exports every public item from
klieo-core. Index-row summary returned bylist_runs. - Simple
Agent - Re-exports every public item from
klieo-core. CanonicalAgentimplementation for theString → Stringcase. - Summarize
Options - Re-exports every public item from
klieo-core. Tunables forsummarize_history. - Thread
Id - Re-exports every public item from
klieo-core. Identifies a conversation thread for short-term memory scoping. - Tool
Call - Re-exports every public item from
klieo-core. One tool call requested by the assistant. - ToolCtx
- Re-exports every public item from
klieo-core. Narrowed slice ofAgentContext(seeagent.rs) passed to tools. - ToolDef
- Re-exports every public item from
klieo-core. Tool catalogue entry shown to the LLM. - Usage
- Re-exports every public item from
klieo-core. Token usage report.
Enums§
- Agent
Context Builder Error - Re-exports every public item from
klieo-core. Error returned when a required field is missing fromAgentContextBuilder. - Agent
Event - Re-exports every public item from
klieo-core. Step-level event emitted by the runtime duringAgent::run. Wire shape is transport-agnostic; MCP HTTP maps each variant to anotifications/progressJSON-RPC notification. - Approval
Decision - Re-exports every public item from
klieo-core. Operator decision delivered toresume_from_checkpoint. - BusError
- Re-exports every public item from
klieo-core. Inter-agent bus errors. - Config
Error - Re-exports every public item from
klieo-core. Configuration validation errors. - Deployment
Profile - Re-exports every public item from
klieo-core. Bundles several individually-opt-in tenant-isolation guards into one fail-closed posture. The default (Unprofiled) leaves each guard’s fail-open default in place (ADR-022 partial-deployment posture);RegulatedMultiTenantflips them closed and refuses to build if a prerequisite is missing. - Episode
- Re-exports every public item from
klieo-core. One event in the episodic event stream of a single agent run. - Error
- Re-exports every public item from
klieo-core. Top-level error returned byklieo-coreruntime calls. - Finish
Reason - Re-exports every public item from
klieo-core. Reason the provider stopped generating. - Guardrail
Outcome - Re-exports every public item from
klieo-core. Validator outcome returned byGuardrail::pre_llmandGuardrail::post_llm. - LlmError
- Re-exports every public item from
klieo-core. LLM provider errors. - Memory
Error - Re-exports every public item from
klieo-core. Memory persistence errors. - Ownership
Check - Re-exports every public item from
klieo-core. Verdict ofOwnershipRegistry::check_ownerfor an enforcement gate, with the fail-open/closed policy already applied so every transport resolves a store error the same way. - Ownership
Claim - Re-exports every public item from
klieo-core. Outcome ofOwnershipRegistry::claim_guardedat a stream-open gate, with the fail-open/closed policy already applied so neither transport re-derives it. (NoDebug—OwnershipHandlewraps a non-DebugArc<dyn KvStore>.) - Ownership
Record - Re-exports every public item from
klieo-core. Outcome ofOwnershipRegistry::record_owner— a persistent ownership claim for a task whose lifetime outlives the request that created it (a non-streaming invoke), with the fail-open/closed policy already applied. - Profile
Violation - Re-exports every public item from
klieo-core. A way a builder’s configuration fails to satisfy itsDeploymentProfile. Transports wrap this in their own build-error type. - Response
Format - Re-exports every public item from
klieo-core. Output format hint passed to the provider. - Role
- Re-exports every public item from
klieo-core. Speaker role. - Scope
- Re-exports every public item from
klieo-core. Namespacing for long-term memory facts. - Server
Outbound Error - Re-exports every public item from
klieo-core. Failure modes for aServerOutbound::outbound_requestcall. - Tool
Error - Re-exports every public item from
klieo-core. Tool invocation errors. - Tool
Result - Re-exports every public item from
klieo-core. Outcome of a tool invocation as recorded in the episodic event stream.
Constants§
- CHECKPOINT_
BUCKET - Re-exports every public item from
klieo-core. Bucket under which suspended-run checkpoints persist inKvStore. - FAILOVER_
ATTEMPT_ CAP - Re-exports every public item from
klieo-core. Hard cap on the number of failover re-invoke attempts per stream.
Traits§
- AckHandle
Impl - Re-exports every public item from
klieo-core. Implementor side of an ack handle. Exposed so impls can supply backend behaviour without callers reaching into private types. - Agent
- Re-exports every public item from
klieo-core. One agent — a typed function fromInputtoOutputplus prompt configuration. - Audit
Redactor - Re-exports every public item from
klieo-core. Injectable redaction port. - Claim
Handle Impl - Re-exports every public item from
klieo-core. Implementor side of a claim handle. - Episodic
Memory - Re-exports every public item from
klieo-core. Append-only event log of agent runs. - Guardrail
- Re-exports every public item from
klieo-core. Pre/post-LLM validator. Implementors decide whether to allow, refuse, or hand off based on the outgoing request and incoming response. - JobQueue
- Re-exports every public item from
klieo-core. Durable competing-consumer job queue. No ordering guarantee — workloads requiring order must usePubsubon a partitioned subject with one consumer per partition instead. - Klieo
Response - Re-exports every public item from
klieo-core. Trait implemented by types that can be parsed from a structured LLM response. - KvStore
- Re-exports every public item from
klieo-core. Bucket-keyed durable KV store with CAS. - Lease
Impl - Re-exports every public item from
klieo-core. Implementor side of a lease. - LlmClient
- Re-exports every public item from
klieo-core. LLM provider trait. - Long
Term Memory - Re-exports every public item from
klieo-core. Long-term semantic memory. - Pubsub
- Re-exports every public item from
klieo-core. Pub/sub interface (subject-based, durable consumers). - Request
Reply - Re-exports every public item from
klieo-core. Synchronous request/response over the bus. - Review
Policy - Re-exports every public item from
klieo-core. Decides whether a run must pause for human approval after an LLM step, before its tool calls are dispatched.Ok(None)proceeds;Ok(Some(reason))suspends the run withreasonrecorded on the checkpoint. - Server
Outbound - Re-exports every public item from
klieo-core. Transport-agnostic surface for issuing a JSON-RPC request from the server back to its peer. - Short
Term Memory - Re-exports every public item from
klieo-core. Conversation buffer scoped to a single thread. - Tool
- Re-exports every public item from
klieo-core. One executable tool. - Tool
Invoker - Re-exports every public item from
klieo-core. Dispatches tool calls by name.
Functions§
- extract_
traceparent - Re-exports every public item from
klieo-core. Extract a W3C tracecontext fromheaders. Returns the default empty Context when no headers are set; callers should set the result as the parent of subsequent spans only if they care about cross-replica stitching. - gc_
checkpoints - Re-exports every public item from
klieo-core. Reap abandoned suspended-run checkpoints, returning the count deleted. An entry whosecreated_atis at or beforecutoffis removed; the bound is inclusive. Best-effort throughout: a checkpoint that fails to read or deserialize, or whose delete fails, is logged and skipped so one bad entry never stalls the sweep. Thecutoffis typicallyUtc::now() - ttl. - inject_
traceparent - Re-exports every public item from
klieo-core. Inject the current OpenTelemetry context’s tracecontext intoheadersunder the standard W3C keys (traceparent, optionallytracestate). - opaque_
digest - Re-exports every public item from
klieo-core. Fail-closed total-opacity fallback used when noAuditRedactoris wired on a redaction-flagged tool. - parse_
structured - Re-exports every public item from
klieo-core. Parse an LLM reply (raw text content) into a typedT. - principal_
hash - Re-exports every public item from
klieo-core. PII-safe principal identifier for span attributes. - resume_
from_ checkpoint - Re-exports every public item from
klieo-core. Resume a run suspended via the review gate (ADR-045). - run_
steps - Re-exports every public item from
klieo-core. Drive the agent’s LLM/tool loop until completion. Caller is responsible for appending the user message before invoking — this function only consumes / extends short-term memory. - run_
steps_ streaming - Re-exports every public item from
klieo-core. Drive the agent’s LLM/tool loop the same waysuper::run_stepsdoes, but expose the underlying provider chunks as they arrive. - spawn_
checkpoint_ gc - Re-exports every public item from
klieo-core. Spawn the opt-in background task that reaps abandoned suspended-run checkpoints everyinterval, deleting any older thanttl. Key thettlto the review-item timeout SLA so a checkpoint never outlives the review it backs (ADR-045 item 7) — without it, abandoned suspensions leakKvStoreentries forever. Memory-bounded viagc_checkpoints(page-walk, one checkpoint resident at a time). Attltoo large to represent skips that sweep rather than reaping everything. Returns aCheckpointGcHandlewhoseDropaborts the task. - spawn_
kv_ reaper - Re-exports every public item from
klieo-core. Spawn a reaper task that scansbucketseveryintervaland evicts entries whose corresponding resume buffer is terminal. - summarize_
history - Re-exports every public item from
klieo-core. Run a rolling summarization checkpoint against the thread’s short-term history. - validate_
subject_ token - Re-exports every public item from
klieo-core. Validate thattokenis safe to embed as a single NATS subject segment.
Type Aliases§
- Chunk
Stream - Re-exports every public item from
klieo-core. Streaming response handle. - Embedding
- Re-exports every public item from
klieo-core. Vector embedding for one input text. - Headers
- Re-exports every public item from
klieo-core. Opaque headers accompanying a bus message. - MsgStream
- Re-exports every public item from
klieo-core. Stream of messages delivered to a subscriber. - Revision
- Re-exports every public item from
klieo-core. CAS revision returned by KV writes. - Secret
String - Re-exported
secrecy::SecretString. Activated by thesecrecyfeature, whichbus-nats,llm-anthropic,llm-openai,llm-genai,memory-neo4j, andmemory-qdrantauto-enable.
Attribute Macros§
- tool
- Re-export of the
#[tool]attribute at crate root so#[klieo::tool(...)]works without an extrause. The fullklieo::macros::toolpath remains valid. Turn anasync fninto aklieo_core::Toolimplementation.
Derive Macros§
- Klieo
Response - Re-export of the
#[derive(KlieoResponse)]derive at crate root so#[derive(klieo::KlieoResponse)]works without an extrause. Deriveklieo_core::KlieoResponsefor a struct so it can be the typed payload of a structured LLM response.