-
Notifications
You must be signed in to change notification settings - Fork 15
Quick Start
The shortest path from zero to a running TinyAgents graph, plus the crate layout you will navigate as you go deeper.
There is no tinyagents facade crate — every crate in the workspace has
publish = false, so none of them are on crates.io. Add the crates you need
as git or path dependencies. For example, as a git dependency pinned to a
commit or branch:
[dependencies]
tinyagents-harness = { git = "https://github.com/tinyhumansai/tinyagents", package = "tinyagents-harness" }
tinyagents-graph = { git = "https://github.com/tinyhumansai/tinyagents", package = "tinyagents-graph" }Or, working inside a checkout of this repository, as a path dependency (this
is how tinyagents-integration-tests/Cargo.toml depends on the other
workspace crates):
[dependencies]
tinyagents-harness = { path = "../tinyagents-harness" }
tinyagents-graph = { path = "../tinyagents-graph" }Add only the crates your project actually uses:
-
tinyagents-harness— model calls, tools, middleware, streaming. -
tinyagents-graph— the durable state-graph runtime. -
tinyagents-language— the.ragblueprint format. -
tinyagents-registry— the named capability catalog. -
tinyagents-session— durable session history.
The OpenAI-compatible provider (tinyinference::providers::openai::OpenAiModel,
a dependency of tinyagents-harness) is compiled in by default, and the build
stays offline unless you actually make a call.
Each crate gates its own optional backends:
-
tinyagents-harness:sqlite(the SQLite-backed response cache),tools(the built-in tool implementations),multimodal(image/data-URI handling),tracing. -
tinyagents-graph:sqlite(SqliteCheckpointer),tracing. -
tinyagents-registryandtinyagents-session:tracingonly. -
tinyagents-language: no optional features.
Tracing instrumentation compiles to a no-op unless the tracing feature is
enabled on the crate you're using. Enable what you need:
tinyagents-graph = { path = "../tinyagents-graph", features = ["sqlite"] }To use a hosted model, export your key (and optionally point at a different model or base URL):
export OPENAI_API_KEY=...
export OPENAI_MODEL=gpt-4.1-mini # optional
export OPENAI_BASE_URL=https://api.openai.com/v1 # optionalThe same OpenAiModel adapter reaches other providers (Anthropic, Ollama,
DeepSeek, Groq, xAI, OpenRouter, Together, Mistral, and other
OpenAI-compatible endpoints) through named constructors. See
Providers.
To work against the source or run the bundled examples, clone the canonical repository:
git clone https://github.com/tinyhumansai/tinyagents.git
cd tinyagents
cargo test --workspaceUseful local checks (these mirror CI):
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo build --workspace --all-targets
cargo test --workspaceThe basic graph example needs no provider credentials and runs fully offline:
cargo run -p tinyagents-integration-tests --example basic_graphIt threads typed Rust state through a small two-node graph, routes
conditionally after the agent node, and exits when the state no longer needs
the tool:
flowchart TD
Start((START)) --> Agent[agent]
Agent -->|needs_tool| Tool[tool]
Tool --> Agent
Agent -->|done| End((END))
OpenAI-backed examples need OPENAI_API_KEY:
export OPENAI_API_KEY=...
cargo run -p tinyagents-integration-tests --example openai_chatOther offline examples include complex_graph, durable_graph,
resilient_graph, agent_loop_tools, rag_blueprint, goals_and_todos, and
subconscious_loop; hosted examples include openai_tools,
openai_structured, openai_graph_agent, orchestrator_subagents, and
openai_self_blueprint. See Examples.
TinyAgents is organized as a virtual Cargo workspace with crates/* members
and no facade crate. Knowing where each piece lives makes the source easy to
navigate:
-
crates/tinyagents-harness/— provider-neutral model calls, typed tools, middleware, structured output, streaming, usage/cost, retry/limits, cache, memory/embeddings, sub-agents, steering, summarization, and testkit doubles. -
crates/tinyagents-graph/— durable typed state graphs withSTART/END, nodes, edges, conditional routing, commands,Sendfanout, reducers/channels, checkpoints, interrupts, subgraphs, and topology export. -
crates/tinyagents-registry/— the named capability catalog (models, tools, agents, graphs, routers, reducers) that.ragbinds by name. -
crates/tinyagents-language/— the declarative.ragblueprint language (lexer → parser → compiler). -
crates/tinyagents-session/— durable SQLite-backed session history and run ledger. -
crates/tinyagents-tracing/— shared, feature-gated tracing macros. -
crates/tinyagents-integration-tests/— cross-crate tests (tests/) and runnable examples (examples/); not a library dependency.
Supporting paths:
-
docs/spec/— contributor-facing system specification. -
wiki/— this GitHub wiki source.
-
Examples — work through the runnable examples, including the
.ragblueprint demos. - Architecture — how the crates compose end to end.
- Harness and Graph Runtime — the two crates most applications start with.
Provider-neutral agent harness and durable state-graph runtime for Rust.
Getting started
Concepts
Modules
Providers
Contributing