Skip to content

SPT Examples

Practical examples demonstrating SPT capabilities for vector intelligence, agent coordination, and distributed systems.

SptDB (Vector Database)

Work with SPT's vector database and memory operations.

ExampleDescription
Batch QueryExecute multiple vector queries with throughput metrics
Batch StoreStore multiple patterns/vectors in bulk with progress tracking
Cached QueryQuery cache layer with TTL for repeated queries (2000x speedup)
Connection PoolConnection pool manager for concurrent database access
Perf MonitorPerformance monitor that tracks query/store metrics

Swarm Coordination

Multi-agent swarm orchestration and QUIC transport.

ExampleDescription
Multi-Agent DeploymentFull swarm deployment with hierarchical topology and 4 agent types
QUIC Server CoordinatorQUIC server as central coordinator for distributed agent swarms
QUIC Swarm CoordinationDistributed code review and refactoring pipeline over QUIC

ReasoningBank

Self-learning reasoning system with SAFLA capabilities.

ExampleDescription
BenchmarkPerformance benchmark suite for storage, query, and optimisation
Learning DemoSelf-learning with semantic pattern storage and cross-domain queries
OptimizeOptimisation suite: VACUUM, caching, batch ops, performance tips

NATS Integration (Legacy)

Legacy NATS examples. The core transport has been replaced by SPT Wire (spt-wire crate, QUIC-based). NATS remains available as a SmartConnector for bridging to external systems. See ADR-088.

ExampleDescription
Swarm Pub/SubPub/sub patterns for agent status, task distribution, memory coordination
JetStream Task QueuePersistent task queues with at-least-once delivery and consumer groups
KV Agent StateKey-value store for real-time agent state management with watches

Prerequisites

  • Node.js 18+
  • For swarm examples: ANTHROPIC_API_KEY environment variable
  • For legacy NATS examples: nats-server running locally
  • For ReasoningBank: npx spt CLI available

Released under the MIT License.