### Setup with local checkout using uv Source: https://github.com/laserdata/laser-sdk/blob/main/examples/python/README.md Syncs the local SDK checkout with testing and examples extras, then runs log.py. Requires uv and does not need pip in /usr/bin/python3. Run from the examples/python/ directory. ```sh uv sync --project ../../foreign/python --locked --extra testing --extra examples uv run --project ../../foreign/python python log.py ``` -------------------------------- ### Setup with published package using uv Source: https://github.com/laserdata/laser-sdk/blob/main/examples/python/README.md Creates a virtual environment, installs the laser-sdk package, and runs log.py. Requires uv and does not need pip in /usr/bin/python3. Run from the examples/python/ directory. ```sh uv venv uv pip install laser-sdk uv run python log.py ``` -------------------------------- ### Run locally with Apache Iggy Source: https://github.com/laserdata/laser-sdk/blob/main/examples/python/README.md Starts Apache Iggy with just up, then runs event_analytics.py. With no environment set, examples connect to iggy:iggy@127.0.0.1:8090. ```sh just up python3 event_analytics.py ``` -------------------------------- ### Run the interop example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/interop/README.md Run `npm run setup` once, then run from `examples/typescript` to start the interop example. The deterministic model is the default; set one provider key to use a real model behind the same `LlmClient` interface. ```sh npm run example:interop ``` -------------------------------- ### Run governance example with just up Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/governance/README.md Starts the local stack and runs the governance example from the examples/rust directory. ```sh just up && cargo run --example governance ``` -------------------------------- ### Run the context example with npm run example:context Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/context/README.md Run `npm run setup` once, then execute this command from `examples/typescript` to run the context example. ```sh npm run example:context ``` -------------------------------- ### Run the recall example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/recall/README.md Run `npm run setup` once, then execute this command from `examples/typescript` to run the recall example. ```sh npm run example:recall ``` -------------------------------- ### Run governance example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/governance/README.md Run the governance example from the examples/typescript directory. Requires npm run setup once beforehand. ```sh npm run example:governance ``` -------------------------------- ### Run against LaserData Cloud with host and token Source: https://github.com/laserdata/laser-sdk/blob/main/examples/python/README.md Uses LASER_SERVER for the bootstrap host and LASER_TOKEN for authentication. TLS and embedded CA attach automatically for *.laserdata.cloud and *.laserdata.com. ```sh # Form B: host plus separate auth LASER_SERVER='starter-123.us-west-1.aws.laserdata.cloud' \ LASER_TOKEN='' \ python3 event_analytics.py ``` -------------------------------- ### Run the recall example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/recall/README.md Starts the required services and runs the recall example from the examples/rust directory. ```sh just up && cargo run --example recall ``` -------------------------------- ### Run fleet-tape example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/fleet-tape/README.md Run the example once after setup. Use from examples/typescript. ```sh npm run example:fleet-tape ``` -------------------------------- ### Install example dependencies and build local SDK package Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/README.md Run from the examples/typescript directory to install dependencies and build the local SDK package. Requires Node 22.14 or later. ```sh npm run setup ``` -------------------------------- ### Run native-streaming example with just up Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/native-streaming/README.md Run from `examples/rust` to start the example. Requires `just` and the Rust toolchain. ```sh just up && cargo run --example native-streaming ``` -------------------------------- ### Run the log example with npm Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/log/README.md Run `npm run setup` once, then execute the example from `examples/typescript` with `npm run example:log`. It runs on Apache Iggy without LaserData Cloud. ```sh npm run example:log ``` -------------------------------- ### Run the agent example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/agent/README.md Run `npm run setup` once, then execute `npm run example:agent` from `examples/typescript` to run the agent example. ```sh npm run example:agent ``` -------------------------------- ### Run the incident-desk example (npm run example:incident-desk) Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/incident-desk/README.md Run the example from the examples/typescript directory after running npm run setup once. Requires query, KV compare-and-swap, and forks for the full desk; on Apache Iggy it reports the first missing managed surface and exits before starting the agents. ```sh npm run example:incident-desk ``` -------------------------------- ### Run the query example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/query/README.md Run `npm run setup` once, then run from `examples/typescript` to execute the example. This requires the managed backend of Laser Stack or LaserData Cloud; on Apache Iggy without a managed backend, it prints a skip notice and returns. ```sh npm run example:query ``` -------------------------------- ### Run the context example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/context/README.md Run from the examples/rust directory. Requires the local Apache Iggy setup via 'just up'. ```sh just up && cargo run --example context ``` -------------------------------- ### Run the agent example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/agent/README.md Run from `examples/rust` to start the agent example. Requires `just up` to bring up the runtime. ```sh just up && cargo run --example agent ``` -------------------------------- ### Run the log example with just up and cargo run Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/log/README.md Run from the examples/rust directory. Starts the required services with `just up` and then executes the example binary named `log`. ```sh just up && cargo run --example log ``` -------------------------------- ### Run graph example with npm Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/graph/README.md Run the graph example after setup. Requires the managed backend of Laser Stack or LaserData Cloud; on Apache Iggy without a managed backend, it prints a skip notice and returns. ```sh npm run example:graph ``` -------------------------------- ### Run native streaming example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/README.md Starts Apache Iggy and runs the native-streaming example. With no environment set, connects to iggy:iggy@127.0.0.1:8090. Each example uses its own laser--typescript stream. ```sh npm run example:native-streaming ``` -------------------------------- ### Run the watch example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/watch/README.md Run `npm run setup` once, then execute the example from `examples/typescript`. Requires the managed backend of Laser Stack or LaserData Cloud; on Apache Iggy without a managed backend, it prints a skip notice and returns. ```sh npm run example:watch ``` ```sh LASER_CONNECTION_STRING=user:pwd@your-host npm run example:watch ``` -------------------------------- ### Run event-analytics example (local, cloud, soak) Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/event-analytics/README.md Commands to run the example from examples/rust. The first starts a local server with live stream and resumable export. The second enables the schema coda against Laser Stack or LaserData Cloud. The third runs a soak test with millions of events. ```sh # local server: live stream plus resumable export just up && cargo run --release --example event-analytics ``` ```sh # against Laser Stack or LaserData Cloud (enables the schema coda) LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ cargo run --release --example event-analytics ``` ```sh # soak: millions of events LASER_MESSAGES=2000000 LASER_BATCH=1000 cargo run --release --example event-analytics ``` -------------------------------- ### Run against LaserData Cloud with connection string Source: https://github.com/laserdata/laser-sdk/blob/main/examples/python/README.md Uses LASER_CONNECTION_STRING with embedded credentials or a token. TLS and embedded CA attach automatically for *.laserdata.cloud and *.laserdata.com. Port defaults to 8090 when omitted. ```sh # Form A: bare target with embedded credentials or a token LASER_CONNECTION_STRING='user:pwd@starter-123.us-west-1.aws.laserdata.cloud' \ python3 event_analytics.py ``` -------------------------------- ### Run the kv example with npm run example:kv Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/kv/README.md Run `npm run setup` once, then run from `examples/typescript`. Requires the managed backend of Laser Stack or LaserData Cloud; on Apache Iggy without a managed backend, the example prints a skip notice and returns. ```sh npm run example:kv ``` -------------------------------- ### Run event-analytics example (npm run example:event-analytics) Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/event-analytics/README.md Commands to run the example locally on Apache Iggy, against LaserData Cloud, or with a larger message count. Requires `npm run setup` once before running from `examples/typescript`. ```sh # local Apache Iggy npm run example:event-analytics # LaserData Cloud LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ npm run example:event-analytics # larger run LASER_MESSAGES=2000000 npm run example:event-analytics ``` -------------------------------- ### Run the memory example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/memory/README.md Run `npm run setup` once, then run from `examples/typescript`. The vector phase needs no server; durable memory and graph traversal require Laser Stack or LaserData Cloud. Without `LASER_CONNECTION_STRING` or `LASER_SERVER` set, the example runs only the vector phase and never connects. ```sh npm run example:memory ``` -------------------------------- ### Run interop example with just up and cargo run Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/interop/README.md Run from examples/rust. The first command starts the environment. The cargo run commands launch the interop example with a deterministic mock model by default, or with Anthropic or OpenAI features using their respective API keys. ```shell just up cargo run --example interop # deterministic mock model cargo run --example interop --features llm-anthropic # Anthropic cargo run --example interop --features llm-openai # OpenAI ``` -------------------------------- ### Export LASER_CONNECTION_STRING and run log example Source: https://github.com/laserdata/laser-sdk/blob/main/README.md Sets the connection string environment variable for the examples, which read LASER_CONNECTION_STRING. The second command runs the log example with the variable set for one command. ```sh export LASER_CONNECTION_STRING='' LASER_CONNECTION_STRING='' cargo run --example log ``` -------------------------------- ### Run the orchestra example with just up Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/orchestra/README.md Starts the required infrastructure and runs the example from the examples/rust directory. The example pauses for Enter after each phase unless LASER_NON_INTERACTIVE is set. ```sh just up && cargo run --example orchestra ``` -------------------------------- ### Run the orchestra example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/orchestra/README.md Run the example from examples/typescript after npm run setup. Pauses for Enter after each phase unless LASER_NON_INTERACTIVE=1 is set. ```sh npm run example:orchestra ``` -------------------------------- ### Run fleet-tape example with local server or LaserData Cloud Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/fleet-tape/README.md Run from examples/rust. The first command starts a local server and runs the example; the second runs against a LaserData Cloud deployment, enabling the Avro schema-first tape. Requires LASER_CONNECTION_STRING for the cloud deployment. ```sh # a local server: live fleet view plus typed tape replay just up && cargo run --example fleet-tape # a LaserData Cloud deployment (enables the Avro schema-first tape) LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host cargo run --example fleet-tape ``` -------------------------------- ### Install laser-sdk Python package Source: https://github.com/laserdata/laser-sdk/blob/main/README.md Installs the laser-sdk package from PyPI. ```sh pip install laser-sdk ``` -------------------------------- ### Run locally with just and cargo Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/README.md Starts Apache Iggy on 127.0.0.1:8090, runs the event-analytics example, then stops the server. With no environment set, laser() uses iggy:iggy@127.0.0.1:8090. ```sh just up # start a server on 127.0.0.1:8090 cargo run --example event-analytics just down # stop it ``` -------------------------------- ### Run firehose example (npm run example:firehose) Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/firehose/README.md Run the firehose example from the examples/typescript directory after running npm run setup once. All firehose controls are explicit via environment variables. ```sh npm run example:firehose ``` -------------------------------- ### Run graph example with LASER_CONNECTION_STRING Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/graph/README.md Run the graph example with a custom connection string for the managed backend. ```sh LASER_CONNECTION_STRING=user:pwd@your-host npm run example:graph ``` -------------------------------- ### Run the query example with cargo Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/query/README.md Run the example from the `examples/rust` directory. Requires a `LASER_CONNECTION_STRING` environment variable pointing to a LaserData Cloud host or managed backend. ```sh LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ cargo run --example query ``` -------------------------------- ### Run the kv example with cargo Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/kv/README.md Run the example from the examples/rust directory. Requires the managed backend in Laser Stack or LaserData Cloud; without it, the example explains the requirement and exits successfully. ```sh LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ cargo run --example kv ``` -------------------------------- ### Run the memory example (local, no server) Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/memory/README.md Runs the example from `examples/rust`. The memory half needs no server. ```sh cargo run --release --example memory ``` -------------------------------- ### Install @laserdata/laser-sdk npm package Source: https://github.com/laserdata/laser-sdk/blob/main/README.md Installs the @laserdata/laser-sdk package from npm. ```sh npm install @laserdata/laser-sdk ``` -------------------------------- ### Run incident-desk example Source: https://github.com/laserdata/laser-sdk/blob/main/docs/tutorial.md Runs the incident-desk agentic demo from the examples/rust directory. Requires Apache Iggy to be up via `just up`. The example demonstrates triage fan-out, LLM synthesis, semantic recall, effectively-once capacity grants, speculative fork, and log-replayed audit. ```sh cargo run --example incident-desk # the incident desk: triage fan-out + LLM synthesis, # semantic recall, effectively-once capacity grants behind # a durable approval, speculative fork, log-replayed audit ``` -------------------------------- ### Bootstrap and create a ticket session Source: https://github.com/laserdata/laser-sdk/blob/main/docs/building-agents.md Bootstrap the agent topics once with a retention for `agent.sessions`, then open one session per ticket. The label derives a stable id, so the same ticket always reaches the same session. `begin` writes the start record on the session lane and returns a lease that keeps the session in this process's heartbeat. ```rust let sessions = laser.sessions(); sessions .bootstrap(4, TopicRetention::expire_after(Duration::from_secs(7 * 86_400))) .await?; let (session, lease) = sessions .create(format!("ticket-{ticket_id}")) .agent("classifier".parse::()?) .begin() .await?; ``` -------------------------------- ### Example role grants in text format Source: https://github.com/laserdata/laser-sdk/blob/main/docs/building-agents.md Shows the textual representation of a role as a set of grants. Grants use 'allow' or 'deny' with a feature and resource pattern, e.g., 'allow kv:read on prefix:support/'. This is used to define managed capabilities for a role. ```text allow kv:read on prefix:support/ allow projection:admin on literal:support_tickets deny kv:write on prefix:support/secrets/ ``` -------------------------------- ### Run example against Apache Iggy with LASER_CONNECTION_STRING Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/README.md Runs the fleet-tape example against an Apache Iggy deployment using Iggy's native VSR transport. The connection string format is user:pwd@host:port. ```sh LASER_CONNECTION_STRING='user:pwd@iggy-host:8090' \ cargo run --example fleet-tape ``` -------------------------------- ### Run governance example against Laser Stack or LaserData Cloud Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/governance/README.md Runs the RBAC phase against a remote host by setting LASER_CONNECTION_STRING. ```sh LASER_CONNECTION_STRING='user:pwd@your-host' \ cargo run --example governance ``` -------------------------------- ### Run native-streaming example with LASER_CONNECTION_STRING Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/native-streaming/README.md Point the SDK at a desired Iggy deployment by setting `LASER_CONNECTION_STRING` to `user:pwd@iggy-host:8090` before running the example. ```sh LASER_CONNECTION_STRING='user:pwd@iggy-host:8090' \ cargo run --example native-streaming ``` -------------------------------- ### Run the kv example with LASER_CONNECTION_STRING Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/kv/README.md Run the example with a connection string for the managed backend. This is an alternative to the default run command. ```sh LASER_CONNECTION_STRING=user:pwd@your-host npm run example:kv ``` -------------------------------- ### Run incident-desk with managed backend and apply plan Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/README.md Runs the incident-desk example against Laser Stack or LaserData Cloud. LASER_APPLY_PLAN=1 acts on the fork verdict (promote or squash) instead of leaving the fork open. ```sh LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ LASER_APPLY_PLAN=1 cargo run --example incident-desk ``` -------------------------------- ### Run incident-desk with real LLM (Anthropic/OpenAI) Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/README.md Build the incident-desk example with a feature flag to use a real LLM instead of the default MockLlm. Requires setting the corresponding API key. ```sh ANTHROPIC_API_KEY=... cargo run --example incident-desk --features llm-anthropic OPENAI_API_KEY=... cargo run --example incident-desk --features llm-openai ``` -------------------------------- ### Run graph example with cargo Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/graph/README.md Run the graph example from the examples/rust directory. Requires a LASER_CONNECTION_STRING environment variable pointing to a LaserData Cloud host. ```sh LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ cargo run --example graph ``` -------------------------------- ### Run the cdc example Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/cdc/README.md Run the example from `examples/typescript` against Laser Stack or LaserData Cloud. Requires managed group configuration and group-policy reads; unsupported deployments print the requirement and skip the showcase. ```sh LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ npm run example:cdc ``` -------------------------------- ### Run the cdc example with LASER_CONNECTION_STRING Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/cdc/README.md Run from `examples/rust` against Laser Stack or LaserData Cloud. The example requires managed group configuration and group-policy reads; unsupported deployments print the requirement and skip the showcase. ```sh LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ cargo run --example cdc ``` -------------------------------- ### Run example:memory against LaserData Cloud with host and token Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/README.md Uses LASER_SERVER for the host and LASER_TOKEN for authentication. The SDK resolves transport and TLS automatically. ```sh LASER_SERVER='starter-123.us-west-1.aws.laserdata.cloud' \ LASER_TOKEN='' \ npm run example:memory ``` -------------------------------- ### Run the watch example with cargo Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/watch/README.md Run the watch example from the examples/rust directory. Requires a LASER_CONNECTION_STRING environment variable pointing to a LaserData Cloud host or managed backend. ```sh LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ cargo run --example watch ``` -------------------------------- ### Run with custom connection string Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/query/README.md Set the `LASER_CONNECTION_STRING` environment variable to connect to a specific host, then run the example. ```sh LASER_CONNECTION_STRING=user:pwd@your-host npm run example:query ``` -------------------------------- ### GET /kv Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md List all namespaces in the key-value store. Use this to see available namespaces. ```APIDOC ## [GET] /kv ### Description List all namespaces in the key-value store. Use this to see available namespaces. ### Method GET ### Endpoint /kv ### Response #### Success Response (200) Returns a list of namespaces. ``` -------------------------------- ### Sessions.start Source: https://github.com/laserdata/laser-sdk/blob/main/foreign/typescript/api/laser-sdk.api.md Creates a new SessionBuilder to start a session. The builder can be used to configure and start the session. ```APIDOC ## Sessions.start ### Description Creates a new SessionBuilder to start a session. The builder can be used to configure and start the session. ### Method start ### Returns SessionBuilder ``` -------------------------------- ### Python example: connect, ensure, publish, replay Source: https://github.com/laserdata/laser-sdk/blob/main/README.md Connects to local Apache Iggy, ensures a topic with 4 partitions, publishes a JSON message, and replays messages. Uses open streaming; add 'managed' for projections, queries, KV, forks, and graphs. ```python import asyncio import laser_sdk as ls async def main(): laser = await ls.Laser.connect("iggy:iggy@127.0.0.1") topic = laser.stream("telemetry").topic("inferences") await topic.ensure(partitions=4) await topic.publish().json({"latency_ms": 42}).send() messages = await topic.replay().poll() print(f"read {len(messages)} message(s)") asyncio.run(main()) ``` -------------------------------- ### Laser::get_bindings Source: https://github.com/laserdata/laser-sdk/blob/main/AGENTS.md Gets bindings. ```APIDOC ## Laser::get_bindings ### Description Gets bindings. ### Method SDK method ### Endpoint Laser::get_bindings ``` -------------------------------- ### Rust example: connect, ensure, publish, replay Source: https://github.com/laserdata/laser-sdk/blob/main/README.md Connects to local Apache Iggy, ensures a topic with 4 partitions, publishes a JSON message, and replays messages. Uses open streaming; add 'managed' for projections, queries, KV, forks, and graphs. ```rust use laser_sdk::prelude::*; #[tokio::main] async fn main() -> Result<(), LaserError> { let laser = Laser::connect("iggy:iggy@127.0.0.1").await?; let topic = laser.stream("telemetry").topic("inferences"); topic.ensure(4, None).await?; topic.publish().json(&serde_json::json!({ "latency_ms": 42 }))?.send().await?; let messages = topic.replay()?.poll().await?; println!("read {} message(s)", messages.len()); Ok(()) } ``` -------------------------------- ### Run the log example with a custom server Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/src/log/README.md Pass a bare target via `LASER_CONNECTION_STRING` to use another server instead of the default Apache Iggy. ```sh LASER_CONNECTION_STRING=user:pwd@your-host npm run example:log ``` -------------------------------- ### Run example:memory against LaserData Cloud with connection string Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/README.md Passes a bare connection target via LASER_CONNECTION_STRING. The SDK adds the transport scheme, defaults the port to 8090, and attaches TLS with the embedded LaserData CA for *.laserdata.cloud and *.laserdata.com. ```sh LASER_CONNECTION_STRING='user:pwd@starter-123.us-west-1.aws.laserdata.cloud' \ npm run example:memory ``` -------------------------------- ### Rust: Connect and use every Laser primitive Source: https://github.com/laserdata/laser-sdk/blob/main/README.md Rust example showing the full Laser SDK surface: streams, queries, graphs, watch, KV, forks, agents, context, memory, sessions, and workflows. Requires a running Laser server at iggy:iggy@127.0.0.1. The SDK never calls a model; you complete model calls manually. Sessions are serializable and can be persisted anywhere. ```rust use std::time::Duration; let laser = Laser::connect("iggy:iggy@127.0.0.1").await?; let readings = laser.stream("fleet").topic("readings"); let audit = laser.stream("audit").topic("events"); // Log: streams group topics, topics carry your records. readings.ensure(4, None).await?; audit.ensure(4, None).await?; readings.publish().json(&reading)?.send().await?; audit.publish().json(&event)?.send().await?; let mut replay = readings.replay()?; // Views: declared projections answer queries, the graph answers traversals. let rows = laser .query("readings_v1") .where_eq("status", "degraded") .limit(10) .fetch() .await?; let nearby = laser.graph("kg").neighbors(node, EdgeDir::Out, None, 2).await?; let mut feed = laser.watch().index("readings_v1").records()?; // await-then-query // State: point reads and writes, optimistic concurrency, branches. laser .kv("sessions") .set("user:42") .json(&session)? .ttl(Duration::from_secs(300)) .send() .await?; let draft = laser.fork("what-if"); // Fabric: identities, context, memory, coordination. let reply = laser.agent(id).ask(commands, replies, task, &prov, timeout).await?; // Context: one task streams its messages, keeps its memory, resolves its deps. let ctx = laser.context(conversation); ctx.append(AgentTopic::Sessions, b"step done").await?; let facts = ctx.memory("support").recall().semantic("rollout incidents").fetch().await?; let deps = ctx.graph("services").neighbors(node, EdgeDir::Out, None, 2).await?; // Session: one unit of work with a recorded lifecycle, model and tool calls, and state. let (session, lease) = laser.sessions().create("ticket-42").agent("triage".parse::()?).begin().await?; let call = session.model(ModelRequest::new("gpt-4o", prompt), None).await?; call.complete(ModelResponse { body: answer, ..Default::default() }).await?; // the SDK never calls a model session.state().set("status", serde_json::json!("triaged")).await?; let turns = session.context().await?; // the session lane, last 50 records within 4000 tokens let facts = session.memory().search("login bug").await?; let checkpoint = session.checkpoint().await?; // serializable, persist it anywhere session.end().await?; drop(lease); // Hand work to another agent as a submitted session. let submitted = laser.sessions().submit("worker".parse::()?, task).from("triage".parse::()?).send().await?; laser.memory("notes").set("current-plan", plan_json).await?; // named point state, an event on the memory topic let outcome = laser.workflow("rollback").step(/* .. */).run().await?; // a root session, each step a child ``` -------------------------------- ### Run repository gates with just lint, test, test-it, bdd, parity-check, ci Source: https://github.com/laserdata/laser-sdk/blob/main/README.md Run the repository gates from the root. Each command runs a specific set of checks: lint (fmt + sort + machete + clippy -D warnings), test (workspace unit tests), test-it (integration tests against Apache Iggy), bdd (cross-SDK BDD conformance, needs Docker), parity-check (Rust, Python, and TypeScript surfaces match docs/parity.md), and ci (the full gate). ```sh just lint # fmt + sort + machete + clippy -D warnings just test # workspace unit tests just test-it # integration tests against Apache Iggy just bdd # cross-SDK BDD conformance (needs Docker) just parity-check # Rust, Python, and TypeScript surfaces match docs/parity.md just ci # the full gate (lint, tests, integration, python-docs, vocabulary, parity, wasm, deny, advisories, fuzz, bdd) ``` -------------------------------- ### Run verification commands Source: https://github.com/laserdata/laser-sdk/blob/main/examples/typescript/README.md Runs format check, typecheck, build, and a specific test file. `npm run smoke` additionally runs native streaming, interop, and primitives against a live Apache Iggy instance, and starts `cdc`, which skips on a server without the filter catalog. ```sh npm run format:check npm run typecheck npm run build node --test dist/test/common.test.js ``` -------------------------------- ### Define role, bind roles, and whoami in Rust Source: https://github.com/laserdata/laser-sdk/blob/main/docs/building-agents.md Rust example using the laser_sdk wire authz types to define a role with a grant, bind it to a user, and query the current identity. Requires an authenticated Laser instance. The role grants KV read access on a prefix. ```rust use laser_sdk::wire::authz::{Action, Effect, Feature, Grant, ResourcePattern, Role}; laser .define_role(Role { name: "support-reader".into(), grants: vec![Grant { effect: Effect::Allow, feature: Feature::Kv, action: Action::Read, resource: ResourcePattern::prefix("support/"), }], }) .await?; laser.bind_roles(user_id, vec!["support-reader".into()]).await?; let who = laser.whoami().await?; ``` -------------------------------- ### GET /filters/{id} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets a single filter by ID. ```APIDOC ## [GET] /filters/{id} ### Description Gets a single filter by ID. ### Method GET ### Endpoint /filters/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The filter ID. ### Response #### Success Response (200) - The filter. ``` -------------------------------- ### GET /authz/users/{id}/roles Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets the roles bound to a user. ```APIDOC ## [GET] /authz/users/{id}/roles ### Description Gets the roles bound to a user. ### Method GET ### Endpoint /authz/users/{id}/roles ### Parameters #### Path Parameters - **id** (string) - Required - The user ID. ### Response #### Success Response (200) - JSON array of role names. ``` -------------------------------- ### GET /filters/operations/{operation_id} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets the status of a filter mutation operation. ```APIDOC ## [GET] /filters/operations/{operation_id} ### Description Gets the status of a filter mutation operation. ### Method GET ### Endpoint /filters/operations/{operation_id} ### Parameters #### Path Parameters - **operation_id** (string) - Required - The operation ID. ### Response #### Success Response (200) - Operation status. ``` -------------------------------- ### TypeScript example: connect, ensure, publish, replay Source: https://github.com/laserdata/laser-sdk/blob/main/README.md Connects to local Apache Iggy, ensures a topic with 4 partitions, publishes a JSON message, and replays messages. Uses open streaming; add 'managed' for projections, queries, KV, forks, and graphs. ```ts import { Laser } from "@laserdata/laser-sdk" await using laser = await Laser.connect("iggy:iggy@127.0.0.1") const topic = laser.stream("telemetry").topic("inferences") await topic.ensure(4) await topic.publish().json({ latency_ms: 42 }).send() const messages = await (await topic.replay()).poll() console.log(`read ${messages.length} message(s)`) ``` -------------------------------- ### GET /sessions/{stream}/{id}/sources Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets sources for a session. ```APIDOC ## [GET] /sessions/{stream}/{id}/sources ### Description Gets sources for a session. ### Method GET ### Endpoint /sessions/{stream}/{id}/sources ### Parameters #### Path Parameters - **stream** (string) - Required - The stream identifier. - **id** (string) - Required - The session ID. ### Response #### Success Response (200) - JSON form of the `Ok` outcome. ``` -------------------------------- ### GET /filter-bindings/{stream}/{topic}/{group} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets a specific filter binding. ```APIDOC ## [GET] /filter-bindings/{stream}/{topic}/{group} ### Description Gets a specific filter binding. ### Method GET ### Endpoint /filter-bindings/{stream}/{topic}/{group} ### Parameters #### Path Parameters - **stream** (string) - Required - The stream. - **topic** (string) - Required - The topic. - **group** (string) - Required - The group. ### Response #### Success Response (200) - The filter binding. ``` -------------------------------- ### laser.sessions().create(label).agent(id).begin() Source: https://github.com/laserdata/laser-sdk/blob/main/docs/tutorial.md Creates and begins a session with a recorded lifecycle. Returns a Session and SessionLease for managing the session. ```APIDOC ## laser.sessions().create(label).agent(id).begin() ### Description Creates and begins a session with a recorded lifecycle. Returns a Session and SessionLease for managing the session. ### Method SDK method ### Parameters - `label` - Required - Session label. - `id` - Required - Agent ID. ### Response Returns a tuple `(Session, SessionLease)`. ``` -------------------------------- ### GET /authz/roles/{name} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets a single role by name. Returns 404 if not found. ```APIDOC ## [GET] /authz/roles/{name} ### Description Gets a single role by name. Returns 404 if not found. ### Method GET ### Endpoint /authz/roles/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The role name. ### Response #### Success Response (200) - The Role. #### Error Response - 404 if not found. ``` -------------------------------- ### GET /sessions/{stream}/{id}/links Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets links for a session, optionally filtered by surface. ```APIDOC ## [GET] /sessions/{stream}/{id}/links ### Description Gets links for a session, optionally filtered by surface. ### Method GET ### Endpoint /sessions/{stream}/{id}/links ### Parameters #### Path Parameters - **stream** (string) - Required - The stream identifier. - **id** (string) - Required - The session ID. #### Query Parameters - **surface** (string) - Optional - Filter by surface. ### Response #### Success Response (200) - JSON form of the `Ok` outcome. ``` -------------------------------- ### GET /sessions/{stream}/{id}/state Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets the state of a session. Optionally limits history. ```APIDOC ## [GET] /sessions/{stream}/{id}/state ### Description Gets the state of a session. Optionally limits history. ### Method GET ### Endpoint /sessions/{stream}/{id}/state ### Parameters #### Path Parameters - **stream** (string) - Required - The stream identifier. - **id** (string) - Required - The session ID. #### Query Parameters - **history_limit** (integer) - Optional - Limit on history. ### Response #### Success Response (200) - JSON form of the `Ok` outcome. ``` -------------------------------- ### GET /projections/{id} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Get a specific projection. Use this to retrieve details of a single projection. ```APIDOC ## [GET] /projections/{id} ### Description Get a specific projection. Use this to retrieve details of a single projection. ### Method GET ### Endpoint /projections/{id} ### Parameters #### Path Parameters - id (string) - Required - The projection ID. ### Response #### Success Response (200) Returns the projection details. ``` -------------------------------- ### validateSessionStart Source: https://github.com/laserdata/laser-sdk/blob/main/foreign/typescript/api/laser-sdk-full.api.md Validates a session start. Throws an error if the start is invalid. ```APIDOC ## validateSessionStart(start: SessionStart): void ### Description Validates a session start. Throws an error if the start is invalid. ### Parameters - **start** (SessionStart) - Required - The session start to validate. ### Returns void ``` -------------------------------- ### GET /graphs/{id} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets a single graph projection by ID. Returns 404 for the other kind of projection. ```APIDOC ## [GET] /graphs/{id} ### Description Gets a single graph projection by ID. Returns 404 for the other kind of projection. ### Method GET ### Endpoint /graphs/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The graph projection ID. ### Response #### Success Response (200) - The graph projection. #### Error Response - 404 if the ID is not a graph projection. ``` -------------------------------- ### GET /sessions/{stream}/{id}/events Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets events for a session. Supports pagination and a fixed frontier. ```APIDOC ## [GET] /sessions/{stream}/{id}/events ### Description Gets events for a session. Supports pagination and a fixed frontier. ### Method GET ### Endpoint /sessions/{stream}/{id}/events ### Parameters #### Path Parameters - **stream** (string) - Required - The stream identifier. - **id** (string) - Required - The session ID. #### Query Parameters - **cursor** (string) - Optional - Pagination cursor. - **limit** (integer) - Optional - Page size. - **fixed_frontier** (string) - Optional - Fixed frontier. ### Response #### Success Response (200) - JSON form of the `Ok` outcome. ``` -------------------------------- ### GET /graph/{name}/neighbors/{node} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Get neighbors of a node in a graph. Use this to traverse the graph. ```APIDOC ## [GET] /graph/{name}/neighbors/{node} ### Description Get neighbors of a node in a graph. Use this to traverse the graph. ### Method GET ### Endpoint /graph/{name}/neighbors/{node} ### Parameters #### Path Parameters - name (string) - Required - The graph name (percent-encoded). - node (string) - Required - The node identifier (percent-encoded). #### Query Parameters - dir (string) - Optional - Direction of edges. - edge_type (string) - Optional - Edge type filter. - depth (integer) - Optional - Traversal depth. - limit (integer) - Optional - Maximum number of results. - as_of (string) - Optional - As-of timestamp. - conversation (string) - Optional - Conversation filter. ### Response #### Success Response (200) Returns the neighbors. ``` -------------------------------- ### ConsumerGroupSetup::create Source: https://github.com/laserdata/laser-sdk/blob/main/sdk/README.md Creates a consumer group with an optional filter. The filter is configured on the server and runs for all consumers of the group. ```APIDOC ## ConsumerGroupSetup::create ### Description Creates a consumer group with an optional filter. The filter is configured on the server and runs for all consumers of the group. ### Method Builder method ### Parameters - **filter** (optional) - The filter to attach to the group. If omitted, the group is unbound and receives all records. ### Returns - **ConsumerGroupCreationResult** - The result containing the created group's ID. ### Example ```rust let setup = topic.consumer_group("on-call-review"); let created = setup .create() .filter("slow-or-failed", slow_or_failed) .build() .await?; ``` ``` -------------------------------- ### GET /destinations/{id}/table/metrics Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Get the metrics of the physical table. Use this to monitor table performance. ```APIDOC ## [GET] /destinations/{id}/table/metrics ### Description Get the metrics of the physical table. Use this to monitor table performance. ### Method GET ### Endpoint /destinations/{id}/table/metrics ### Parameters #### Path Parameters - id (string) - Required - The destination ID. ### Response #### Success Response (200) Returns the table metrics. ``` -------------------------------- ### GET /destinations/{id}/checkpoint Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Get the checkpoint of a destination. Use this to retrieve the last committed checkpoint. ```APIDOC ## [GET] /destinations/{id}/checkpoint ### Description Get the checkpoint of a destination. Use this to retrieve the last committed checkpoint. ### Method GET ### Endpoint /destinations/{id}/checkpoint ### Parameters #### Path Parameters - id (string) - Required - The destination ID. ### Response #### Success Response (200) Returns the checkpoint information. ``` -------------------------------- ### Run incident-desk example with various configurations Source: https://github.com/laserdata/laser-sdk/blob/main/examples/rust/src/incident-desk/README.md Commands to run the incident-desk example from examples/rust. The local server prints the managed requirement and exits green. Against LaserData Cloud, the full desk runs. Heavy world uses a million tickets. Real model features require ANTHROPIC_API_KEY or OPENAI_API_KEY. LASER_APPLY_PLAN=1 promotes or squashes the plan. LASER_DESK_GRANT_TIMEOUT_SECS increases the grant-apply phase timeout. ```sh # local server: prints the managed requirement and exits green just up && cargo run --release --example incident-desk ``` ```sh # against LaserData Cloud, full desk LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ cargo run --release --example incident-desk ``` ```sh # heavy world: a million tickets LASER_MESSAGES=1000000 LASER_BATCH=1000 cargo run --release --example incident-desk ``` ```sh # real model instead of the deterministic mock ANTHROPIC_API_KEY=... cargo run --release --example incident-desk --features llm-anthropic OPENAI_API_KEY=... cargo run --release --example incident-desk --features llm-openai ``` ```sh # apply the speculative plan's verdict instead of leaving the fork open LASER_APPLY_PLAN=1 cargo run --release --example incident-desk ``` ```sh # a heavily rate-limited deployment (a free-tier bandwidth cap, say) needs more # than the default 180s to settle the grant-apply phase LASER_DESK_GRANT_TIMEOUT_SECS=600 \ LASER_CONNECTION_STRING=user:pwd@your-laserdata-cloud-host \ cargo run --release --example incident-desk ``` -------------------------------- ### GET /destinations/{id}/status Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Get the status of a destination. Use this to check the health or state of a destination. ```APIDOC ## [GET] /destinations/{id}/status ### Description Get the status of a destination. Use this to check the health or state of a destination. ### Method GET ### Endpoint /destinations/{id}/status ### Parameters #### Path Parameters - id (string) - Required - The destination ID. ### Response #### Success Response (200) Returns the destination status. ``` -------------------------------- ### GET /destinations/{id} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Get details of a specific destination. Use this to retrieve information about a single destination. ```APIDOC ## [GET] /destinations/{id} ### Description Get details of a specific destination. Use this to retrieve information about a single destination. ### Method GET ### Endpoint /destinations/{id} ### Parameters #### Path Parameters - id (string) - Required - The destination ID. ### Response #### Success Response (200) Returns the destination details. ``` -------------------------------- ### Bootstrap sessions and run a session with model call Source: https://github.com/laserdata/laser-sdk/blob/main/docs/tutorial.md Bootstraps the agent.sessions topic with a 7-day retention, then creates a session with label 'ticket-4821' and runs a closure that assembles context, calls the model, completes the response, and sets state. The session ends as completed on success or failed on error/panic. ```rust use laser_sdk::agent::{ModelRequest, ModelResponse, TopicRetention}; laser .sessions() .bootstrap(4, TopicRetention::expire_after(Duration::from_secs(7 * 86_400))) .await?; let (session, lease) = laser .sessions() .create("ticket-4821") .agent("planner".parse::()?) .begin() .await?; let summary = session .run(lease, |session| async move { let assembled = session.assemble(Box::new(LastN(20))).await?; let call = session .model(ModelRequest::new("gpt-4o", assembled.text()), Some(&assembled)) .await?; let answer = b"it is a login bug".to_vec(); // your provider call goes here call.complete(ModelResponse { body: answer.clone(), ..Default::default() }) .await?; session.state().set("status", serde_json::json!("triaged")).await?; Ok(answer) }) .await?; ``` -------------------------------- ### Path mode provisioning configuration Source: https://github.com/laserdata/laser-sdk/blob/main/bench/README.md Configure provisioning to run caller-provided native binaries and record their digests. Use this mode when you supply your own binaries. ```toml [provisioning] mode = "path" cpu_target = "skylake" iggy_server = "/absolute/path/to/iggy-server" iggy_bench = "/absolute/path/to/iggy-bench" backend = "/absolute/path/to/backend" ``` -------------------------------- ### GET /sessions/{stream}/{id} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Gets a single session by its ID. A missing session answers 404 with not_found. ```APIDOC ## [GET] /sessions/{stream}/{id} ### Description Gets a single session by its ID. A missing session answers 404 with not_found. ### Method GET ### Endpoint /sessions/{stream}/{id} ### Parameters #### Path Parameters - **stream** (string) - Required - The stream identifier. - **id** (string) - Required - The session ID (26-character string). ### Response #### Success Response (200) - JSON form of the `Ok` outcome. #### Error Response - 404 with `not_found` if the session is missing. ``` -------------------------------- ### GET /kv/{namespace}/{key} Source: https://github.com/laserdata/laser-sdk/blob/main/docs/agdx.md Get a value from the key-value store. Use this to retrieve a value by namespace and key. ```APIDOC ## [GET] /kv/{namespace}/{key} ### Description Get a value from the key-value store. Use this to retrieve a value by namespace and key. ### Method GET ### Endpoint /kv/{namespace}/{key} ### Parameters #### Path Parameters - namespace (string) - Required - The namespace. - key (string) - Required - The key. ### Response #### Success Response (200) Returns the raw value as the response body. The optional expiry is in the `agdx-expires-at-micros` response header. #### Response (404) Returns 404 when the key is absent. ```