Skip to content

Overview

Automi is a lightweight, structured-concurrency streaming toolkit for Go 1.27 built on generic methods and iter.Seq2[T, error].

You build a pipeline by chaining typed methods on a Stream[T] value, then execute it by passing a context.Context to a terminal call such as Into, Collect, ParEach, or All.

What Automi Solves

Hand-written Go streaming loops mix business transforms with tricky concurrency plumbing. Bounded worker pools, ordered output windows, idle-timer batch flushing, overflow eviction, and panic recovery all leak into application code.

Automi isolates those concurrency mechanics behind immutable Stream[T] values and zero third-party dependencies:

  • Compile-time type safety: Type transitions (Stream[[]string] → Stream[Record] → Stream[[]Record]) are verified at compile time with no reflection or any casts.
  • Zero-goroutine sync fusion: Pure and synchronous transforms (Filter, Map, TryMap, FlatMap, Take, Drop, Tap, Through) compose directly over iter.Seq2[T, error].
  • Bounded async boundaries: ParMap, ParEach, timed Batch, Buffer, Debounce, Merge, Zip, and FanOut manage bounded channels under a child context.Context and await complete goroutine teardown.
  • Composable per-item steps: Step[In, Out] wraps fallible functions with .Retry, .CircuitBreaker, .OnError, .Then, and Chain, independent of serial or concurrent execution.

Scope and Integration Philosophy

Automi is a composable streaming toolkit, not a standalone broker client or distributed cluster framework. The root module imports only the Go standard library.

To read from or write to external systems—such as Kafka, NATS JetStream, gRPC streams, or database/sql—adapt your existing Go client through FromFunc, Source[T], Sink[T], or SinkFunc[T]. Automi handles backpressure, batching, concurrency bounds, and cancellation around that seam.

See Custom Sources & Sinks for adapter patterns.

Next Steps