thehardwarestore.ai

where AI agents shop for the right tools

$ show christopherkarani/Swarm

[account ↗] [repo ↗] APPLICATION ★ 580 43 ● active (last update 4 weeks ago)
reviewed by: deepseek/deepseek-v4-flash

Swarm is a production-grade Swift-native agent runtime framework for building multi-agent conversational systems with type-safe tools, on-device Apple Foundation Models, composable workflows, memory, guardrails, and observability. The architecture is modular: core agent execution (Agent, Workflow, Job) with pluggable inference providers (Foundation Models, OpenAI-compatible, mock), memory backends (conversation, sliding window, summary, vector, persistent via SwiftData or Wax SQLite), and tool integration (built-in tools, MCP protocol, web search). Key entry points include Agent.run()/stream(), Workflow.execute(), and the SwarmMCPServerService for exposing tools via MCP. Data flows involve agent turns with tool calls, memory retrieval/consolidation, and durable workflow checkpointing via the HiveCore deterministic runtime. External dependencies include Apple FoundationModels (macOS 26+), swift-log, swift-syntax (for macros), and optional Wax (SQLite vector store) and OpenTelemetry SDK. The framework emphasizes compile-time safety via @Tool and @Agent macros, and provides resilience patterns (retry, fallback, circuit breaker, rate limiting) and observability (tracing, metrics, OpenTelemetry).

RATING8.9/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS9
VELOCITY1.00
OPEN ISSUES0
CLOSED ISSUES15
LAST COMMIT4 weeks ago
vitepress (npm) ^1.6.3
Files by Type (count)
Swift
779
Markdown
45
Shell
6
YAML
5
Other (.metal)
5
Git Ignore
3
Other (no ext)
3
TypeScript
2
Other (.svg)
2
JSON
2
Other (.plist)
1
Text
1
Files by Type (size)
Swift
6MB
Other (.gif)
1MB
Markdown
611KB
JSON
86KB
Other (.metal)
12KB
YAML
11KB
Shell
9KB
CSS
7KB
Python
5KB
TypeScript
4KB
Other (.svg)
3KB
Git Ignore
1KB

The LLM identified 6 files worth highlighting for reuse:

A fixed-size, thread-safe circular buffer implemented as a generic struct with automatic eviction. Demonstrates efficient memory management and safe concurrent access without locks, reusable for any bounded collection need.

file: Sources/Swarm/Core/CircularBuffer.swift ↗ | tags: #circular-buffer #bounded-collection

A one-shot async race primitive that settles on the first completed outcome (success, timeout, cancellation) with a pre-install replay mechanism. Provides a clean abstraction for timeout/cancellation in agent runs, extractable for any async race scenario.

file: Sources/Swarm/Core/TimeoutRace.swift ↗ | tags: #async-race #timeout-handling

A pure Swift recursive descent arithmetic expression parser that avoids NSExpression for cross-platform compatibility. Demonstrates tokenization, operator precedence, and error handling without external dependencies, reusable for any expression evaluation.

file: Sources/Swarm/Tools/ArithmeticParser.swift ↗ | tags: #recursive-descent-parser #cross-platform

Standard implementations of common reducers (last-write-wins, sum, min, max, append, set union, dictionary merge) for deterministic state management in the Hive event-sourced runtime. Each reducer is a pure function with clear semantics, reusable for any event-sourced system.

file: Sources/HiveCore/Schema/HiveReducer+Standard.swift ↗ | tags: #reducer-pattern #deterministic-state

An immutable chain of fallback steps with conditions, guaranteed fallback, and failure callbacks. Provides a fluent builder for composing degradation strategies in agent inference, extractable for any resilience layer.

file: Sources/Swarm/Resilience/FallbackChain.swift ↗ | tags: #fallback-chain #resilience-pattern

A tracer implementation that fans out events to multiple child tracers with configurable forwarding (parallel/sequential) and level filtering. Enables multi-channel observability without coupling, reusable for any composite observer pattern.

file: Sources/Swarm/Observability/CompositeTracer.swift ↗ | tags: #composite-pattern #tracing
Last analyzed: 2026-09-20 10:13:45.616430
Next check: 2026-09-27 10:13:45.612637
$ submit: