# Swiftide: typed task graphs and streaming RAG pipelines in Rust

> Swiftide is an MIT-licensed Rust framework that combines an agent harness, strongly typed task graphs and streaming indexing/query pipelines for LLM applications. It suits Rust teams that want compile-time structure around agent loops and retrieval, and it asks for a recent toolchain.

**bosun-ai/swiftide** — Fast, streaming indexing, query, and agentic LLM applications in Rust

- Repository: https://github.com/bosun-ai/swiftide
- Website: https://swiftide.rs
- Stars: 787 · Forks: 70
- Language: Rust
- License: MIT
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/bosun-ai-swiftide

## What Swiftide solves, and for whom

Most LLM application code drifts into a pile of scripts: a prompt here, a retry there, a vector store call somewhere else. Swiftide's answer is to make the structure explicit in Rust. The README describes it as "an opinionated framework for building LLM applications" that gives you an agent harness, typed task graphs for orchestration, and streaming, composable indexing and query pipelines for RAG. The intended reader is a Rust developer who wants the compiler to check the shape of a workflow before it runs.

The three primitives are described as a shared interaction model, with a division of labour: pipelines for data flows, agents for tool loops, and tasks for graphs of typed hand-offs. That split matters. If you are indexing a corpus, you want the pipeline. If you are letting a model call functions until it decides to stop, you want the agent. If you are routing a document through several stages where each stage has its own input and output type, you want the task graph.

The repository is a Cargo workspace, not a single crate. Top-level entries include swiftide-agents, swiftide-core, swiftide-indexing, swiftide-integrations, swiftide-langfuse, swiftide-macros, swiftide-query and swiftide-tasks. The README states that default dependencies are kept light and that you add the integrations your application needs. That is a deliberate trade-off: a smaller default build, but more decisions for you at the manifest level.

## How the agent harness, task graphs and pipelines fit together

The agent harness owns message history, calls an LLM, invokes tools, runs hooks, and handles stopping. The README says the AgentContext abstracts over message history, in memory by default, and gives tools access to the outside world through a ToolExecutor, local by default. There is a separate docker executor project linked from the README. Lifecycle hooks fire before and after completions, tools, messages, streaming chunks, start and stop. Stop and failure payloads can carry custom JSON schemas, and the README notes that all agents have a tool to stop the loop by default, which can be customized.

Tasks are the orchestration layer. The README defines a task as a typed graph of TaskNode steps, where each node has an input type, an output type and an error type, and transitions decide where the output goes next. In the excerpted example, `Task<Prompt, String>` is built by registering nodes: a prompt model, a briefing agent, and a render step. Because the types are known at build time, a mismatched hand-off is a compile error rather than a runtime surprise. That is the strongest argument for this library over a scripting approach, and also the reason it will feel heavy if your workflow is genuinely three lines long.

Pipelines cover the data path: loaders, transformers, embedders, caches and storage backends, streamed rather than materialised. Tracing runs through `tracing`, with metrics and Langfuse support, and there is a dedicated swiftide-langfuse crate in the workspace. Tools can come from local Rust functions, custom `Tool` implementations, or MCP servers loaded at runtime.

## Installing Swiftide and running a first agent

The README's Quick Start adds the crate with the agent and OpenAI features, plus `anyhow` and Tokio with the macros and multi-thread runtime features. The workspace manifest pins `rust-version = "1.97"` and `edition = "2024"`, so check your toolchain before anything else.

```bash
cargo add swiftide --features swiftide-agents,openai
cargo add anyhow
cargo add tokio --features macros,rt-multi-thread
```

If you use OpenAI, the README says to set the API key expected by the OpenAI-compatible integration. The value is not shown in the README, so supply your own key rather than copying a placeholder.

```bash
export OPENAI_API_KEY=...
```

The first real program is the tool example. A function is annotated with the `swiftide::tool` macro, given a description and a named parameter, and returns a `ToolOutput`. The agent builder takes the model, the tools, an `on_new_message` hook that prints each message, and a turn limit.

```rust
#[swiftide::tool(
    description = "Looks up a Swiftide concept",
    param(name = "concept", description = "Concept to explain")
)]
async fn explain_concept(
    _context: &dyn AgentContext,
    concept: &str,
) -> Result<ToolOutput, ToolError> {
    Ok("Swiftide composes agents, task graphs, tools, and RAG pipelines.".into())
}
```

```rust
let openai = swiftide::integrations::openai::OpenAI::builder()
    .default_prompt_model("gpt-4o-mini")
    .build()?;

agents::Agent::builder()
    .llm(&openai)
    .tools([explain_concept()])
    .limit(8)
    .build()?
    .query("Explain Swiftide tasks and agents in one paragraph.")
    .await?;
```

What you should see is the agent calling the model, exposing `explain_concept` as a tool, printing new messages through the hook, and stopping within the configured turn limit. The README points to `examples/hello_agents.rs` as the next step, then to the human approval, MCP, streaming, resume and structured-output examples. The examples directory also contains index_codebase.rs, hybrid_search.rs, reranking.rs and index_md_into_pgvector.rs, which is a useful map of what the project believes it is for.

## Where Swiftide will fight you

The cost of the typed approach is visible up front. Every node in a task graph needs an input type, an output type and an error type, and the README's own example needs a shared `Arc<dyn SimplePrompt>` and a wrapper type before the graph can be assembled. For a two-step prompt chain, that is more ceremony than the problem deserves, and a plain async function would be easier to read.

The agent harness keeps message history in memory by default. The README lists resume examples and mentions pausing and resuming agents or tasks for human approval, external callbacks or persisted state, but it does not describe a default durable store, so long-running or crash-sensitive agents need you to supply that layer. Similarly, the README does not document rollback behaviour for indexing runs, which matters if you are re-indexing a corpus and need to know what happens to the previous version.

Tool execution is local by default. Running model-chosen code on the host process is a real security decision, and the README's answer is a separate docker executor repository rather than a built-in sandbox. If your threat model requires isolation, factor in that extra integration before you start. Finally, the framework is opinionated by its own description. If your architecture does not resemble agents, task graphs or streaming pipelines, you will spend more time bending the primitives than using them.

## Swiftide against Python RAG frameworks

The obvious alternative is a Python framework such as LangChain, and the difference is not just language preference. A Python chain is assembled at runtime: a mis-typed hand-off between steps surfaces when that path executes. Swiftide's task nodes carry input, output and error types, so the same mistake is caught by the Rust compiler. The README makes this explicit, saying tasks are strongly typed at build time and that this lets you compose agents, other Swiftide components and functions.

The second difference is concurrency and streaming. Swiftide is built on Tokio and its pipelines stream through loaders, transformers, embedders, caches and storage backends rather than building a list in memory first. Task graphs can fan out into parallel branches and join typed results back into one output, which the README lists as a first-class capability. A Python framework can do the same work, but you assemble it from an async runtime plus whatever the individual integrations expose.

The third difference is distribution. Python frameworks are installed from PyPI and run against the interpreter you already have. Swiftide is a set of crates in a Cargo workspace with a pinned minimum toolchain, and its integrations are feature flags you opt into. That is a smaller default dependency surface, and a larger upfront build cost.

## Maintenance, licence and upgrade cost

The last push to the default branch was on 2026-09-09, which is recent enough that the repository is not dormant. The most recent release listed is v0.32.1 from 2025-11-15, preceded by v0.32.0 on 2025-11-06 and v0.31.3 on 2025-10-06. The repository is not archived. Note the version series: the project is still in the 0.x range, so minor bumps can carry breaking changes, and the workspace manifest version tracks the release. The repository includes release-plz.toml and cliff.toml, which is consistent with automated release and changelog generation, and a CHANGELOG.md sits at the top level.

The workspace pins `edition = "2024"` and `rust-version = "1.97"`. Upgrading Swiftide therefore couples to upgrading your toolchain, and any crate in your dependency graph that lags on edition 2024 will block you. Budget for that on major bumps rather than assuming a drop-in replacement.

The licence is MIT, stated in the README badge, the workspace package metadata and a LICENSE file at the repository root. MIT is permissive: it allows use, modification and redistribution provided the copyright notice and permission notice are retained. That is a plain statement of what the file says, not legal advice; if your organisation has licence review, run the LICENSE file past it, and check the licences of the individual integrations you enable, since those carry their own dependencies.

## Conclusion

Adopt Swiftide if your team already writes Rust and wants agent loops, tool calls and retrieval expressed as typed graphs rather than as prompt strings glued together in Python. Do not adopt it if you need a managed service, a GUI, or an ecosystem of prebuilt connectors you can install without reading Rust. Before committing, check the examples directory against your own use case, confirm your toolchain satisfies the rust-version in the workspace manifest, and read the licence text in the repository yourself.

## FAQ

### What is Swiftide?

Swiftide is an MIT-licensed Rust framework for building LLM applications. The README describes it as providing an agent harness, typed task graphs for orchestration, and streaming, composable indexing and query pipelines for RAG.

### How do I install Swiftide?

The README's Quick Start uses cargo add with the agent and OpenAI features, plus anyhow and Tokio with the macros and rt-multi-thread features. The workspace manifest requires Rust 1.97 and edition 2024, so check your toolchain first.

### What can Swiftide agents do beyond calling an LLM?

According to the README, agents own message history, invoke tools, run lifecycle hooks before and after completions, tools, messages, streaming chunks, start and stop, and support human-in-the-loop approval, resume, structured stop payloads and MCP toolboxes loaded at runtime.

### Does Swiftide run tools in a sandbox?

The README states that the ToolExecutor is local by default and links to a separate docker executor project for isolation. If you need model-chosen code to run outside the host process, that is an additional integration rather than a built-in default.

## Sources

- [bosun-ai/swiftide on GitHub](https://github.com/bosun-ai/swiftide)
- [License: MIT](https://github.com/bosun-ai/swiftide/blob/master/LICENSE)
- [Project website](https://swiftide.rs)
- [README](https://github.com/bosun-ai/swiftide/blob/master/README.md)
- [Releases](https://github.com/bosun-ai/swiftide/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/bosun-ai-swiftide
