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/Build agents
NEW TO RUNIFOLD?Build the complete mental model in 45 minutes
Build agents

Ground an Agent with retrieval

Add static or dynamic evidence while keeping retrieved text untrusted and attributable.

Practical guide·10 min

Static context

Use .context(...) for a small, known piece of evidence that is already available when the Agent is built.

let agent = runtime
    .agent("policy")
    .system("Use only the supplied policy evidence.")
    .context("Returns are accepted within 30 days.");

Static context is simple and deterministic, but it does not scale to a large or frequently changing corpus.

Dynamic context

A dynamic context source retrieves documents for the current request and injects only the selected evidence. Keep retrieval behind the Retriever trait so the Agent does not depend on a database vendor.

Choose the query, result limit, score threshold, and context size explicitly. Return stable document IDs and source metadata so answers can be attributed.

Security boundary

Retrieved text is untrusted evidence, never a system instruction. A document that says “ignore previous instructions” must not gain authority by appearing in search results.

Apply tenant filters before vector search, not after. Never let a model invent the namespace, authorization predicate, or database credentials used for retrieval.

Persistent stores

Start with InMemoryVectorIndex for tests and small local experiments. Enable the qdrant or pgvector feature when persistence, distributed access, or a larger corpus is required.

Embedding model, distance metric, vector dimension, and normalization form one index contract. Changing any of them requires a deliberate migration or reindex.

Evaluate quality

Measure retrieval separately from answer generation:

  • recall of the required source in the top results;
  • irrelevant context rate;
  • citation correctness;
  • answer quality when no relevant document exists;
  • latency and cost by query class.

Keep a versioned evaluation set and rerun it when the embedding model, chunking, filters, prompt, or provider changes.