Standalone examples for the Swink-Agent framework — a pure-Rust library for LLM-powered agentic loops.
by_model/ provider & model-specific examples
anthropic/haiku/ Claude Haiku (basic + minimal)
openai/gpt-5/ OpenAI GPT-5
mistral/mistral-large/ Mistral Large
ollama/llama3/ Ollama (local, no API key)
local/{gemma4-e2b, On-device inference via llama.cpp (GGUF)
gemma4-e4b,
smollm3}/
google/gemini/ Google Gemini (GEMINI_API_KEY)
bedrock/claude/ AWS Bedrock — env-based + direct SigV4 construction
openai_compat/multi/ Azure OpenAI, xAI Grok, LM Studio — one binary, --backend flag
by_pattern/ agentic design patterns
tool_use/ builtin tools + FnTool + approval callback
mock_provider/ testing with a mock StreamFn
custom_adapter/ custom StreamFn implementation
swarm/ peer-to-peer agent transfer (TransferToAgentTool)
tui/{basic,yolo} terminal UI via swink-agent-tui
mcp/context7_docs/ MCP client (HTTP/SSE, bearer auth) + ToolDenyListPolicy + AuditLogger
production_guardrails/ Budget + MaxTurns + PromptGuard + PII + ContentFilter +
LoopDetection + ToolMiddleware + StreamMiddleware + MetricsCollector
persistent_chat/ JsonlSessionStore + checkpointing + sliding-window compaction +
steering + SessionState + plan mode
context_versioning/ VersioningTransformer + ContextSummarizer + InMemoryVersionStore
hot_reload/ ScriptTool + ToolWatcher (live-reload from directory) + SandboxPolicy
orchestrator/ AgentOrchestrator + DefaultSupervisor + SupervisorPolicy
pipeline/ Pipeline (sequential → parallel → loop) + FileArtifactStore
parallel_tools/ ToolExecutionPolicy (concurrent / sequential / priority)
prompt_caching/ CacheConfig + CacheStrategy + cache token reporting
observability/ OTel tracing + MetricsCollector + tiktoken TokenCounter
model_fallback/ ModelFallback with loud logging — honest framing of tradeoffs
usecases/ goal-oriented examples
summarization/ single-agent document summarization
research/ web research + file output (WebPlugin)
eval_harness/ EvalRunner + EvalSet + trajectory matching + AuditLogger
Each example is its own Cargo project — cd into the folder and cargo run.
Each example includes:
README.md— what it demonstrates, env vars, how to run, expected outputAGENTS.md— guidance for AI coding agents: scope, key files, deps, config surface, how to modify safely
# Clone the repo
git clone https://github.com/SuperSwinkAI/Swink-Agent-Examples.git
cd Swink-Agent-Examples
# Pick an example
cd by_model/anthropic/haiku/basic
# Set your API key
export ANTHROPIC_API_KEY="sk-ant-..."
# Run it
cargo run- Rust 1.88+ (edition 2024)
- API keys for whichever provider the example targets (see each example's README)
- Create a new directory under the appropriate category (
by_model/,by_pattern/, orusecases/).by_model/paths must be three levels deep:<provider>/<model>/<name>/.by_pattern/andusecases/paths must be two levels deep:<pattern>/<name>/.
cargo initinside it.- Add
swink-agent = "0.7"and any needed crates toCargo.toml. Setedition = "2024",rust-version = "1.88",publish = false. - Write
README.mdcovering: what it demonstrates, prerequisites, configuration (.envlines), how to run, testing, and notes. - Write
AGENTS.mdcovering: scope, key files, dependencies and features, configuration surface, how to modify safely, testing guidance. - Verify it compiles:
cargo checkfrom the example directory, thencargo check --workspacefrom the repo root.