A fast, streaming Rust library for LLM application development — unifying indexing, querying, agents, and task graph orchestration.
Swiftide is a Rust library for LLM application development by bosun.ai, built around a pipeline-first paradigm with async/parallel streaming as its foundation. The project is actively developed (v0.32.1) with frequent breaking changes; the indexing pipeline is the most mature module, while query pipelines and the agent framework are marked experimental.
The indexing pipeline loads from filesystem, web, Fluvio, Parquet, Kafka, and other sources, then processes through Markdown/text/code chunking (Tree-sitter), LLM metadata enrichment (QA pairs, summaries, titles, code definitions/references), embedding, and storage into Qdrant, Redis, LanceDB, Postgres, or DuckDB. Pipelines are composed via a chained Loader → Transformer → Storage API, supporting closures as Transformers, pipeline splitting/merging, and cached filtering.
The query pipeline uses a strongly-typed generic state machine (Pending → Retrieved → Answered) with subquestion generation, hybrid retrieval, and context assembly. The agent framework declares tools via the #[swiftide::tool] proc macro, supporting autonomous LLM-tool loops, inter-agent collaboration, and command execution. Task graphs orchestrate multi-step LLM workflows in a graph structure.
Integrations use a feature-gated design — all third-party dependencies are opt-in. Supported LLM providers include OpenAI, Anthropic, Gemini, Bedrock, Groq, and Ollama; built-in Langfuse and OpenTelemetry tracing; and Ragas evaluation. The architecture separates core abstractions, indexing, querying, agents, integrations, and macros across a multi-crate workspace with minimal core traits for low-friction extension.
Installation:
cargo new my-swiftide-app && cd my-swiftide-app
cargo add swiftide
# Enable feature flags in Cargo.toml as needed, e.g.:
# swiftide = { version = "0.32", features = ["openai", "qdrant"] }
Indexing Pipeline Example:
indexing::Pipeline::from_loader(FileLoader::new(".").with_extensions(&["md"]))
.with_default_llm_client(openai_client)
.then_chunk(ChunkMarkdown::from_chunk_range(10..512))
.then(MetadataQAText::default())
.then_in_batch(Embed::new(FastEmbed::default()))
.then_store_with(
Qdrant::builder()
.batch_size(50)
.vector_size(384)
.collection_name("swiftide-examples")
.build()?,
)
.run().await?;
Query Pipeline Example:
query::Pipeline::default()
.then_transform_query(GenerateSubquestions::from_client(openai_client.clone()))
.then_transform_query(Embed::from_client(openai_client.clone()))
.then_retrieve(qdrant.clone())
.then_answer(Simple::from_client(openai_client.clone()))
.query("How can I use the query pipeline in Swiftide?")
.await?;
Agent Example:
#[swiftide::tool(
description = "Searches code",
param(name = "code_query", description = "The code query")
)]
async fn search_code(
context: &dyn AgentContext,
code_query: &str,
) -> Result<ToolOutput, ToolError> {
let command_output = context
.executor()
.exec_cmd(&Command::shell(format!("rg '{code_query}'")))
.await?;
Ok(command_output.into())
}
agents::Agent::builder()
.llm(&openai)
.tools(vec![search_code()])
.build()?.query("Find an example of a swiftide agent").await?;
Caveats: The project is labeled "under heavy development" with breaking changes risk; query pipelines and the agent framework are both marked Experimental without stability commitments or maturity roadmaps; no official performance benchmarks or public production use cases have been found.