Crates
Swiftide is a Cargo workspace: a set of crates that the swiftide facade crate re-exports as modules. By the end of this page you know which crate holds which part of the API, which swiftide:: path reaches it, and which docs.rs page to open.
use swiftide::{ agents::Agent, // swiftide-agents indexing::{self, loaders::FileLoader}, // swiftide-indexing integrations::openai::OpenAI, // swiftide-integrations prompt::Prompt, // swiftide-core query::{self, answers}, // swiftide-query tasks::{NodeError, Task}, // swiftide-tasks traits::{AgentContext, ToolExecutor}, // swiftide-core};Source: snippets/src/reference/crates.rs#L4-L12
Your application depends on the swiftide crate, and you switch parts on with feature flags. This excerpt needs the swiftide-agents and openai flags:
cargo add swiftide@0.34 --features swiftide-agents,openaiThe facade
Section titled “The facade”The swiftide crate has almost no code of its own. It maps the other crates onto these modules:
swiftide::indexingjoins the indexing types of swiftide-core (Node,TextNode, the indexing traits) with swiftide-indexing. With thetree-sitterflag,swiftide::indexing::transformersalso holds the code transformers.swiftide::queryjoins the query types of swiftide-core (the query state, the search strategies) with swiftide-query.swiftide::traitscollects the traits of swiftide-core in one place:AgentContext,MessageHistory, the chat completion traits, the indexing and query traits,ToolExecutorand the command types.swiftide::promptandswiftide::chat_completioncome straight from swiftide-core.swiftide::integrationsis swiftide-integrations. Each provider or storage module inside it exists only with its feature flag.swiftide::agentsneeds theswiftide-agentsflag,swiftide::taskstheswiftide-tasksflag, andswiftide::langfusethelangfuseflag.swiftide::agents_contribneeds theagents-contribflag, and each of itstools,hooksandexecutorssubmodules needs a capability flag on top.- The
#[tool]attribute, theToolderive and#[indexing_transformer]sit at the crate root, behind themacrosflag.
The facade always depends on swiftide-core, swiftide-indexing, swiftide-query and swiftide-integrations. Agents, tasks, Langfuse and the macros are optional dependencies. The contrib crate is optional too. Feature flags lists every flag and what it turns on.
Workspace crates
Section titled “Workspace crates”| Crate | Contains | Facade path | API docs |
|---|---|---|---|
| swiftide-core | The traits the other crates implement, Node and TextNode, Prompt, chat completion types, ToolExecutor, CommandOutput, search strategies | swiftide::traits, swiftide::prompt, swiftide::chat_completion; Node and TextNode through swiftide::indexing; search strategies through swiftide::query::search_strategies | swiftide_core |
| swiftide-indexing | The indexing pipeline, loaders, transformers, chunkers, MemoryStorage | swiftide::indexing | swiftide_indexing |
| swiftide-query | The query pipeline, query transformers, response transformers, answer generators, evaluators | swiftide::query | swiftide_query |
| swiftide-integrations | One module per provider or storage, each behind its feature flag | swiftide::integrations | swiftide_integrations |
| swiftide-agents | Agent, DefaultContext, hooks, StopReason, LocalExecutor, Model Context Protocol (MCP) tools (with the mcp flag), TaskAgent | swiftide::agents | swiftide_agents |
| swiftide-tasks | Task, TaskNode, Transition, fan-out and join | swiftide::tasks | swiftide::tasks |
| swiftide-langfuse | LangfuseLayer, a tracing layer that reports agent and completion calls to Langfuse | swiftide::langfuse | swiftide_langfuse |
| swiftide-macros | #[tool], the Tool derive, #[indexing_transformer] | crate root | swiftide_macros |
| swiftide-agents-contrib | ReadFile, ExactReplace, ApplyPatch, UpdatePlan, ContextCompression, ToolSummarizer, LazyExecutor | swiftide::agents_contrib | source on GitHub |
swiftide-tasks is new in 0.33. It depends on swiftide-core only. swiftide-agents depends on swiftide-tasks and swiftide-indexing, so the swiftide-agents flag also turns on swiftide-tasks. The old swiftide::agents::tasks module still compiles, but it is deprecated since 0.32.1 and only re-exports the new crate plus TaskAgent.
swiftide-agents-contrib enables nothing by default, and each capability has its own facade flag. Feature flags lists them.
swiftide-test-utils also lives in the workspace. It is internal (publish = false) and not on crates.io.
Direct dependencies
Section titled “Direct dependencies”Applications depend on the facade. A direct dependency on a workspace crate pays off in two cases:
- You write a library that only implements Swiftide traits, such as a loader, a transformer, a tool or a tool executor. swiftide-core defines every one of those traits and keeps your dependency tree small.
- You write an integration for a provider or storage that Swiftide does not ship.
cargo add swiftide-core@0.34Matching versions
Section titled “Matching versions”All crates share one workspace version, 0.34, and each one requires its swiftide dependencies at 0.33. Keep every swiftide crate in your dependency tree on the same minor version. Cargo treats 0.32 and 0.33 as incompatible, so a mix builds two copies of swiftide-core, and a trait from one copy does not accept a type from the other.
Macros and the facade
Section titled “Macros and the facade”#[tool] and the Tool derive expand to paths in the swiftide crate, such as swiftide::chat_completion::ToolSpec. A crate that uses them needs the swiftide crate with its macros flag, even when the rest of its code imports from swiftide-core.
#[indexing_transformer] works the other way round. It expands to paths in swiftide_core, anyhow and derive_builder, not swiftide. A crate that uses it needs those three crates as direct dependencies, next to the facade:
cargo add swiftide-core@0.34 anyhow derive_builderTasks without agents
Section titled “Tasks without agents”The swiftide-tasks flag adds swiftide::tasks without compiling swiftide-agents:
cargo add swiftide@0.34 --features swiftide-tasksThe mcp, langfuse and json-schema flags and every agents-contrib flag turn on swiftide-agents. Enable one of them and agents compile again. Flag relationships shows which flag turns on which.
Versioning
Section titled “Versioning”Only the swiftide crate gets a git tag (v0.34) and a GitHub release, and its changelog covers every crate. Before you move to a new minor version, read Upgrading.
Reference
Section titled “Reference”swiftideswiftide_coreswiftide_indexingswiftide_queryswiftide_integrationsswiftide_agentsswiftide::tasksswiftide_langfuseswiftide_macros- swiftide-agents-contrib source
Next: Changelog