Laser SDK
Stream, filter, query, and coordinate through one SDK for Rust, Python, and TypeScript
Laser SDK provides streaming, queries, state, and agent services through one client. Its source of truth is a durable log, a stored sequence of messages. Query, state, graph, memory, and agent services derive their data from that log.
Operations follow object.verb(input). Rust is the reference implementation, Python binds the Rust core, and TypeScript is a native client. All three pass the same protocol fixtures and behavior scenarios.
AGDX defines the shared model for typed records, managed operations, and agent messages. Laser SDK implements it on Apache Iggy. The clients use Iggy's native connection.
Receive only what each consumer needs. Consumer Filters select records on the server before payloads cross the network. The shared CDC example delivers 4 of 240 records and saves 98.5% of payload transfer, with the same result in Rust, Python, and TypeScript.
Use Laser Stack locally or LaserData Cloud in production. Laser Stack runs the LaserData Iggy fork and laser-plane. Both targets support the same SDK examples.
Two public example repositories go beyond the focused examples. Photon Market composes the primitives across independently runnable Rust services. Frostline is the consumer-filter showcase: one change feed, three teams reading their own slice, and a benchmark of how much payload never left the server.
One grammar, nine primitives
Each primitive groups related operations. Producers and consumer groups belong to topics. Filters belong to consumer groups. Select a resource, then call an action:
| # | Primitive | Accessor | Description | Built for |
|---|---|---|---|---|
| 1 | Log | laser.stream("shop").topic("orders") | Everything starts as a message. An event or command is still a message. The log records it once, then services can read it live, resume from an offset, or replay it from the beginning. | Event-driven services, audit trails, live feeds |
| 2 | Views | laser.query("orders_v1") | A view is a query already kept up to date. Filter, aggregate, paginate, or search without moving events into another database. | Dashboards, order books, analytics APIs |
| 3 | Changes | laser.watch() | Poll a lightweight advancement feed, then query only when the view has moved. It uses the connection you already have. | Live UIs, cache invalidation, reactive pipelines |
| 4 | State | laser.kv("profiles") | Keyed state, with branches. Point reads, compare-and-swap, and TTLs live next to the log. Forks create copy-on-write data branches you can promote or discard. | Sessions, feature flags, what-if simulations |
| 5 | Graph | laser.graph("kg") | Turn entities in your messages into nodes and edges. Traverse them now, search by meaning, or ask what was true at an earlier time. | Knowledge graphs, recommendations, entity resolution |
| 6 | Memory | laser.memory("customer:42") | Remember, recall, improve, and forget on an auditable log. Add a vector backend or reranker when recall needs ranking by meaning. | Assistants that remember users, agents that learn |
| 7 | Context | laser.context(conversation) | Context binds messages and working memory to one conversation, then assembles a bounded prompt-ready history. Sessions add typed turns and checkpointed replay. Shared knowledge graphs remain cross-conversation. | Multi-turn agents, support copilots, session replay |
| 8 | Fabric | laser.agent("triage") | Agents that retry after failure. Agents discover capabilities, delegate work, and receive uncommitted tasks again after failure. Contracts carry deadlines. Workflows carry budgets and compensation. | Multi-agent systems, durable pipelines, approvals |
| Within Log | Consumer-group filters | topic.consumer_group(...).filter() | Send only matching records across the network. Filter payload fields or typed headers while keeping original records, offsets, and safe acknowledgments. | Selective CDC, alert routing, backfills |
laser.destinations() defines materialization targets, the places that store derived data. It also reads their checkpoints and query routes. laser.runs() combines workflow and contract status records into a view of each task. See Managed Data and Fabric. topic.consumer_group(...).filter() configures the group's server-side policy so its consumers receive only matching records. See Consumer Filters. laser.sessions() opens one agent's conversation as typed turns, with a model-ready context, scoped memory, and replay from saved checkpoints. See Context.
You can adopt these layers independently:
- Streaming uses Apache Iggy and is enabled by default.
- Managed services add views, state, graph, a change feed, and forks through Laser Stack or LaserData Cloud.
- Agent services add reliable consumers, memory, contracts, and workflows through Fabric.
All layers use the same client and standard Iggy transport. Filtered readers open node connections as needed for primary routing and group membership.
Install
npm install @laserdata/laser-sdkcargo add laser-sdkpip install laser-sdkOr with uv:
uv pip install laser-sdkPackages are published on crates.io, PyPI, and npm. Source and issues are at github.com/laserdata/laser-sdk.
Get started
Quickstart
Your first message, end to end, in your language
Laser Stack
Run Iggy and laser-plane locally
Connect
Connection strings, env vars, tokens, TLS, and publish retries
The nine primitives
Consumer Filters
Receive only your matches. The CDC example saves 98.5% of payload transfer.
Log
Everything starts as a message.
Views
Ask the stream a question.
Changes
Stop re-querying blind.
State
Keyed state, with branches.
Graph
Follow the relationships.
Memory
Remember what matters.
Context
One conversation, assembled.
Fabric
Agents that retry after failure.
Managed Data describes bindings, query results, destinations, and readiness.