Counting visitors…
Browse all docs
Start · 9Find your path through RunifoldLearn Runifold in 45 minutesUnderstand the complete Runifold platformYour first trustworthy runChoose the right execution APIChoose crates and Cargo featuresBuild common Runifold applicationsRunifold frequently asked questionsTroubleshoot Runifold applications
Execution kernel · 7Understand RunContextCoordinate external effects safelyBound work with budgets and cancellationHandle errors and retries safelyEvents, journals, and execution evidenceDesign capability-safe executionRecover safely from checkpoints
Models & providers · 7Route across models without duplicate outputChoose and configure a providerUse the provider-neutral model protocolBuild on the Provider Runtime contractUse OpenAI control-plane and Realtime APIsTest and benchmark provider adaptersSet up OpenAI, Anthropic, Gemini, and Ollama
Agents · 7Build and configure an AgentGive an Agent typed toolsAdd conversations and semantic memoryDelegate to child Agents safelyReturn structured Rust valuesStream without losing semanticsGround an Agent with retrieval
Durable workflows · 7Compose deterministic workflowsMake workflows durableOperate durable workflow workersCoordinate timers, signals, and durable waitsRun multi-tenant workflow infrastructureRun parallel branches and safe racesVersion and evolve durable workflows
Integrations · 7Connect through MCPChoose stores and persistence boundariesExpose durable work through MCP TasksBuild and evaluate retrieval pipelinesUse MCP Resources, Prompts, and SamplingCache MCP responses without crossing authorityDeploy Runifold in a Rust web service
Quality & operations · 10Test without the networkEvaluate quality and prevent regressionsObserve the complete run treeRun safely in browsers and at the edgeRead reliability claims preciselyRun reproducible evaluations in CIOperate Runifold with SLOsGovern Task retention and deletionArchive audit evidence to S3-compatible WORM storageManage compatibility and trusted releases
Docs/Integrations
NEW TO RUNIFOLD?Build the complete mental model in 45 minutes
Integrations

Use MCP Resources, Prompts, and Sampling

Expose capability-filtered context, keep prompt templates user-controlled, and let the client own model selection and approval.

Practical guide·14 min

Three distinct surfaces

MCP Resources expose application-controlled context. Prompts expose user-controlled message templates. Sampling lets a server request a model call owned and reviewed by the client. None automatically grants Tool authority, mutates an Agent transcript, or trusts returned content.

Keep these surfaces separate in product UI, authorization, audit, and limits.

Discover and consume Resources and Prompts

Use the initialized McpClient from the main MCP guide. The convenience list methods follow pagination up to the configured page bound.

use std::collections::BTreeMap;
 
let initialized = client.initialize().await?;
println!("capabilities: {:?}", initialized.capabilities);
 
for resource in client.list_resources().await? {
    println!("{} — {}", resource.uri, resource.name);
}
let resource = client.read_resource("memory://users/42").await?;
for content in resource.contents {
    println!("{content:?}");
}
 
for prompt in client.list_prompts().await? {
    println!("{} — {:?}", prompt.name, prompt.description);
}
let rendered = client
    .get_prompt(
        "review",
        BTreeMap::from([("language".into(), "rust".into())]),
    )
    .await?;
for message in rendered.messages {
    println!("{message:?}");
}

Do not call Resource, Prompt, or Completion methods unless the initialize result advertises that capability. read_resource returns protocol content; validate the URI and media type before displaying or forwarding it. get_prompt returns messages but never inserts them into an Agent automatically.

Resources

Resources use absolute URIs and ReadOnly capability descriptors. Listing filters by the session Run's authority; reading checks again immediately before execution. Unknown and unauthorized URIs produce the same not-found behavior.

Validate URI identity, content type, decoded binary size, and returned URI. Treat text and binary content as untrusted application data.

Prompts

Prompt descriptors declare stable name, semantic version, arguments, input schema, effect class, and risk. Rendering rejects missing, unknown, blank, or duplicate arguments and bounds message count and serialized size.

prompts/get returns messages to the host. The host decides whether to display, edit, approve, or insert them. A remote Prompt is not a system instruction.

Sampling

The server may request sampling/createMessage, but cannot select Provider credentials or force a model. Client policy validates the request, acquires a concurrency permit, reviews or edits input, reserves conservative token budget, selects a host-owned model, validates output, and reviews the response before disclosure.

Server model hints are advisory. Basic Sampling rejects Tools and ambient MCP context. Denied output is never returned to the server.

Sampling is reverse-direction authority: the MCP server asks the client to spend its model budget. Enable it only by attaching a host-owned SamplingService to McpClientConfig::with_sampling(...). The service requires three explicit pieces: a SamplingApprover, a SamplingProvider (or ModelSamplingProvider), and SamplingPolicy limits. Review happens before the model call and again before output disclosure.

At minimum set request timeout, maximum concurrent requests, maximum lifetime requests, and token limits. A server-provided model hint must be mapped through your allowlist; it must never select credentials or bypass the host's normal model routing policy.

Trust boundaries

Negotiate every capability, recheck per operation, limit payload and lifetime usage, preserve cancellation and deadline over reverse requests, and record redacted Sampling stages. In-process, stdio, and Streamable HTTP transports must implement the same authority and correlation rules.

Failure guide

FailureMeaningAction
capability not negotiatedpeer did not advertise the surfacedisable the UI/action for this session
resource not foundunknown or unauthorized URIdo not reveal which condition occurred
invalid prompt argumentsmissing, unknown, blank, or oversized valuevalidate against the descriptor before calling
repeated pagination cursorbroken or hostile peerstop pagination and fail the operation
Sampling request rejectedapproval policy denied inputreturn denial without invoking a model
Sampling response rejectedoutput policy denied disclosuredo not return model output to the server
deadline exceededrequest or reverse request outlived its boundcancel local work and report typed timeout