### Run TypeScript query example Source: https://docs.laserdata.com/laser-sdk/laser-stack Runs the query example in TypeScript. Requires Node.js 22.14 or later. Run npm run setup once after cloning; it installs dependencies and builds the SDK. Each npm run example: compiles examples first. ```bash cd laser-sdk/examples/typescript npm run setup npm run example:query ``` -------------------------------- ### start() Source: https://docs.laserdata.com/laser-sdk/session Gives a fresh session ID. Requires `.agent(id)` for the agent that owns the session, then `begin()` writes the start record and returns the session with a lease. ```APIDOC ## start() ### Description Gives a fresh session ID. Requires `.agent(id)` for the agent that owns the session, then `begin()` writes the start record and returns the session with a lease. ### Parameters - **agent(id)** (AgentId) - Required - Agent that owns the session. ### Returns - **session** - The session object. - **lease** - The lease that keeps the session listed in the client's heartbeat while your process works on it. ``` -------------------------------- ### Get Setup Instructions (curl GET) Source: https://docs.laserdata.com/networking/private-service-connect Retrieves instructions for a consumer to connect to a service attachment. Requires `deployment:network:read` permission. The response includes the service attachment URI and step-by-step instructions. ```bash curl {supervisor_url}/deployments/{deployment_id}/network/gcp/psc/{attachment_id}/instructions \ -H "ld-api-key: YOUR_API_KEY" ``` ```json { "service_attachment_uri": "projects/ld-prod/regions/us-central1/serviceAttachments/iggy-psc-attachment", "connection_preference": "accept_manual", "instructions": [ "In your GCP project, navigate to Network services → Private Service Connect", "Click 'Connect to a published service' and enter the target service: projects/ld-prod/regions/us-central1/serviceAttachments/iggy-psc-attachment", "Select a subnet and IP address in your VPC for the PSC endpoint", "Click 'Add endpoint' to create the PSC connection", "The connection preference is ACCEPT_MANUAL - your connection will be pending until accepted by the service producer", "Once the connection status is ACCEPTED, use the assigned private IP to reach the service" ] } ``` -------------------------------- ### Start Laser Stack Source: https://docs.laserdata.com/laser-sdk/quickstart Clones the laser-stack repository and starts the stack with the up script. The script waits for Iggy and the managed backend, then prints a LASER_CONNECTION_STRING export to copy into your shell. ```bash git clone https://github.com/laserdata/laser-stack cd laser-stack ./scripts/up ``` -------------------------------- ### Pull the Docker Quickstart Image Source: https://docs.laserdata.com/getting-started/quick-start Pulls the quickstart Docker image from ghcr.io/laserdata/quickstart:latest. Requires Docker installed locally. ```bash docker pull ghcr.io/laserdata/quickstart:latest ``` -------------------------------- ### Run Rust query example Source: https://docs.laserdata.com/laser-sdk/laser-stack Runs the query example in Rust. Requires the toolchain version pinned in rust-toolchain.toml. ```bash cd laser-sdk/examples/rust cargo run --example query ``` -------------------------------- ### Get GCP PSC Setup Instructions (GET) Source: https://docs.laserdata.com/api/networking Retrieves step-by-step instructions for consumers to connect to a specific service attachment. ```bash curl {supervisor_url}/deployments/{deployment_id}/network/gcp/psc/{attachment_id}/instructions \ -H "ld-api-key: YOUR_API_KEY" ``` -------------------------------- ### Allow My IP - GET Response Example Source: https://docs.laserdata.com/networking/access-rules Example response from `GET {supervisor_url}/deployments/{deployment_id}/access_rules/my_ip`. Reports the IP address LaserData sees and whether Allow My IP can admit it. Requires `deployment:access:read`. `refusal` is `ipv6`, `not_public`, or `missing` when the address cannot be admitted, otherwise `null`. `covered_by` is the rule that already admits the address on Iggy HTTP, or `null`. ```json { "ip_address": "203.0.113.7", "refusal": null, "covered_by": { "id": 1, "name": "office", "cidr_blocks": ["203.0.113.0/24"], "valid_to": null } } ``` -------------------------------- ### Run Python query example (local source) Source: https://docs.laserdata.com/laser-sdk/laser-stack Runs the query example in Python using the local SDK source. Requires Python 3.10 or later and uses uv. ```bash cd laser-sdk/examples/python uv sync --project ../../foreign/python --locked --extra testing --extra examples uv run --project ../../foreign/python python query.py ``` -------------------------------- ### Get GCP VPC Peering Setup Instructions Source: https://docs.laserdata.com/networking/vpc-peering GET to retrieve setup instructions for an inactive peering connection. The response includes steps to create the reciprocal connection in GCP Console. ```bash curl {supervisor_url}/deployments/{deployment_id}/network/gcp/vpc_peering/{peering_id}/instructions \ -H "ld-api-key: YOUR_API_KEY" ``` -------------------------------- ### Install Warden on a Node Source: https://docs.laserdata.com/deployments/on-premise Run this command on each node to install Warden. It downloads and verifies binaries, configures services, and starts Warden. Replace and with the values provided by LaserData. ```bash curl -fsSL https://artifacts.laserdata.com/scripts/install.sh | sudo bash -s -- \ --api \ --secret ``` -------------------------------- ### Run Python query example (published package) Source: https://docs.laserdata.com/laser-sdk/laser-stack Runs the query example in Python using the published laser-sdk package. Requires Python 3.10 or later and uses uv. ```bash cd laser-sdk/examples/python uv venv uv pip install laser-sdk uv run python query.py ``` -------------------------------- ### Install, login, explore, and deploy with laser CLI Source: https://docs.laserdata.com/cli Quick start commands for the laser CLI: install via curl, authenticate with a tenant ID, explore tenant info and structure, launch the TUI dashboard, create a starter deployment on AWS or GCP, and watch the deployment until ready. Replace and with actual values. ```bash # install + login curl -fsSL https://cli.laserdata.cloud/install.sh | sh laser auth login --tenant-id # explore your tenant laser tenant get laser tenant structure -o json # launch the dashboard laser tui # spin up a starter deployment (AWS or GCP) laser deployment create-starter --cloud aws --region us-east-1 laser deployment create-starter --cloud gcp --region us-central1 # follow it to ready laser deployment watch --deployment-id ``` -------------------------------- ### Get AWS VPC Peering Setup Instructions Source: https://docs.laserdata.com/networking/vpc-peering Retrieves setup instructions for a specific peering connection. Requires the `deployment:network:read` API key permission. The response provides instructions for the current peering status. ```bash curl {supervisor_url}/deployments/{deployment_id}/network/aws/vpc_peering/{peering_id}/instructions \ -H "ld-api-key: YOUR_API_KEY" ``` -------------------------------- ### Get GCP VPC Peering Setup Instructions - Response Source: https://docs.laserdata.com/networking/vpc-peering Example JSON response from the instructions endpoint, showing an inactive peering with steps to create the reciprocal connection. ```json { "peering_name": "laser-peering-12345", "state": "inactive", "local_vpc_name": "ld-vpc-deployment-611298765432109056", "peer_vpc_name": "my-vpc-network", "peer_project_id": "my-gcp-project", "steps": [ "Open the Google Cloud Console...", "Navigate to VPC network peering...", "..." ] } ``` -------------------------------- ### Get Active Config - response example Source: https://docs.laserdata.com/connectors/configuration Example response showing the active configuration with its version, timestamps, and values. Secret fields like connection_string are masked as ***. ```json { "id": 1, "kind": "connector:sink:postgres", "name": "telemetry-pg-sink", "primary": true, "initialized": true, "version": 2, "created_at": "2026-03-16T12:00:00Z", "updated_at": "2026-03-16T12:05:00Z", "values": { "enabled": true, "streams": [], "plugin_config": { "connection_string": "***", "target_table": "reading_events" }, "transforms": {} } } ``` -------------------------------- ### GET /deployments/{deployment_id}/network/gcp/psc/{attachment_id}/instructions Source: https://docs.laserdata.com/networking/private-service-connect Retrieves setup instructions explaining how a consumer connects to a specific service attachment. Requires the deployment:network:read API key permission. ```APIDOC ## [GET] /deployments/{deployment_id}/network/gcp/psc/{attachment_id}/instructions ### Description Retrieves setup instructions explaining how a consumer connects to a specific service attachment. ### Method GET ### Endpoint {supervisor_url}/deployments/{deployment_id}/network/gcp/psc/{attachment_id}/instructions ### Parameters #### Path Parameters - **deployment_id** (string) - Required - The ID of the deployment - **attachment_id** (string) - Required - The ID of the service attachment ### Response #### Success Response (200) Returns an object with `service_attachment_uri`, `connection_preference`, and an `instructions` array. ### Request Example ``` curl {supervisor_url}/deployments/{deployment_id}/network/gcp/psc/{attachment_id}/instructions \ -H "ld-api-key: YOUR_API_KEY" ``` ### Response Example ``` { "service_attachment_uri": "projects/ld-prod/regions/us-central1/serviceAttachments/iggy-psc-attachment", "connection_preference": "accept_manual", "instructions": [ "In your GCP project, navigate to Network services → Private Service Connect", "Click 'Connect to a published service' and enter the target service: projects/ld-prod/regions/us-central1/serviceAttachments/iggy-psc-attachment", "Select a subnet and IP address in your VPC for the PSC endpoint", "Click 'Add endpoint' to create the PSC connection", "The connection preference is ACCEPT_MANUAL - your connection will be pending until accepted by the service producer", "Once the connection status is ACCEPTED, use the assigned private IP to reach the service" ] } ``` ``` -------------------------------- ### Install TypeScript SDK with npm Source: https://docs.laserdata.com/laser-sdk Install the Laser SDK for TypeScript. Requires Node.js 22.14 or later. ```bash npm install @laserdata/laser-sdk ``` -------------------------------- ### Submit a session (Python) Source: https://docs.laserdata.com/laser-sdk/fabric Starts a session for an agent and puts the input in front of it. The call returns once both records are written. The agent's handler reaches the session through ctx.session() and ends it when the work is done. ```Python async def summarize(ctx, message): print(f"summarizing {bytes(message.body()).decode()}") await ctx.session().end() submitted = await ( laser.sessions() .submit("summarizer", b"summarize incident 7") .from_("intake") .send() ) ``` -------------------------------- ### Submit a session (Rust) Source: https://docs.laserdata.com/laser-sdk/fabric Starts a session for an agent and puts the input in front of it. The call returns once both records are written. The agent's handler reaches the session through ctx.session() and ends it when the work is done. ```Rust struct Summarizer; impl AgentHandler for Summarizer { async fn handle(&self, message: &AgentMessage, ctx: &AgentCtx<'_>) -> Result<(), LaserError> { println!("summarizing {}", String::from_utf8_lossy(message.body())); ctx.session().end().await } } let submitted = laser .sessions() .submit("summarizer".parse::()?, "summarize incident 7") .from("intake".parse::()?) .send() .await?; ``` -------------------------------- ### GET /deployments/{deployment_id}/network/aws/vpc_peering/{peering_id}/instructions Source: https://docs.laserdata.com/networking/vpc-peering Retrieves setup instructions for a specific VPC peering connection. Requires the 'deployment:network:read' permission and an API key. ```APIDOC ## [GET] /deployments/{deployment_id}/network/aws/vpc_peering/{peering_id}/instructions ### Description Retrieves setup instructions for a specific VPC peering connection. Requires the 'deployment:network:read' permission and an API key. ### Method GET ### Endpoint {supervisor_url}/deployments/{deployment_id}/network/aws/vpc_peering/{peering_id}/instructions ### Parameters #### Path Parameters - **deployment_id** (string) - Required - The ID of the deployment. - **peering_id** (integer) - Required - The ID of the peering connection. ### Response #### Success Response (200) The response provides instructions for the current peering status. ### Request Example ``` curl {supervisor_url}/deployments/{deployment_id}/network/aws/vpc_peering/{peering_id}/instructions \ -H "ld-api-key: YOUR_API_KEY" ``` ``` -------------------------------- ### Get Tenant Summary Response (JSON) Source: https://docs.laserdata.com/organization Example response for the tenant summary request. ```json { "total_divisions": 2, "total_environments": 5, "total_deployments": 8 } ``` -------------------------------- ### Install Python SDK with pip Source: https://docs.laserdata.com/laser-sdk Install the Laser SDK for Python. Requires Python 3.10 or later. ```bash pip install laser-sdk ``` -------------------------------- ### GET /deployments/{deployment_id}/network/gcp/vpc_peering/{peering_id}/instructions Source: https://docs.laserdata.com/networking/vpc-peering Retrieves setup instructions for a specific GCP VPC peering connection. For an inactive peering, the response explains how to create its reciprocal connection in GCP Console. ```APIDOC ## [GET] /deployments/{deployment_id}/network/gcp/vpc_peering/{peering_id}/instructions ### Description Retrieves setup instructions for a specific GCP VPC peering connection. For an inactive peering, the response explains how to create its reciprocal connection in GCP Console. ### Method GET ### Endpoint {supervisor_url}/deployments/{deployment_id}/network/gcp/vpc_peering/{peering_id}/instructions ### Parameters #### Path Parameters - **deployment_id** (string) - Required - The ID of the deployment. - **peering_id** (string) - Required - The ID of the peering connection. ### Response #### Success Response (200) Returns the peering details and setup instructions. ### Request Example ``` curl {supervisor_url}/deployments/{deployment_id}/network/gcp/vpc_peering/{peering_id}/instructions \ -H "ld-api-key: YOUR_API_KEY" ``` #### Response Example ``` { "peering_name": "laser-peering-12345", "state": "inactive", "local_vpc_name": "ld-vpc-deployment-611298765432109056", "peer_vpc_name": "my-vpc-network", "peer_project_id": "my-gcp-project", "steps": [ "Open the Google Cloud Console...", "Navigate to VPC network peering...", "..." ] } ``` ``` -------------------------------- ### Record a session in Rust Source: https://docs.laserdata.com/laser-sdk/quickstart Starts a session as 'intake', sends a contract to 'triage' with the session conversation, ends the session, and iterates over the context. Prints the turn display and text for agent messages. Uses the laser SDK's Rust API. ```Rust let (session, _lease) = laser .sessions() .start() .agent("intake".parse::()?) .begin() .await?; laser .contract(Router::to("triage".parse()?)) .from("intake".parse()?) .payload("disk full on node-7") .inbox_route(InboxRoute::Fixed(AgentTopic::Sessions)) .conversation(session.conversation()) .send() .await?; session.end().await?; for turn in session.context().await? { let kind: &str = turn.display.into(); match kind { "agent.message" => println!("{kind}: {}", turn.text()), _ => println!("{kind}"), } } ``` -------------------------------- ### Record a session in Python Source: https://docs.laserdata.com/laser-sdk/quickstart Starts a session as 'intake', sends a contract to 'triage' with the session conversation, ends the session, and prints the context. Prints the turn display and text for agent messages. Uses the laser SDK's Python API. ```Python session, _lease = await laser.sessions().start().agent("intake").begin() await laser.contract( None, b"disk full on node-7", agent="triage", source="intake", fixed_inbox=ls.AgentTopic.Sessions, conversation=session.conversation, ) await session.end() for turn in await session.context(): print(turn.display, turn.text() if turn.display == "agent.message" else "") ``` -------------------------------- ### Submit a session (TypeScript) Source: https://docs.laserdata.com/laser-sdk/fabric Starts a session for an agent and puts the input in front of it. The call returns once both records are written. The agent's handler reaches the session through ctx.session() and ends it when the work is done. ```TypeScript const summarizer = { handle: async (message: AgentMessage, ctx: AgentCtx) => { console.log(`summarizing ${decode(agentMessageBody(message))}`) await ctx.session().end() } } const submitted = await laser .sessions() .submit(AgentId.new("summarizer"), text.encode("summarize incident 7")) .from(AgentId.new("intake")) .send() ``` -------------------------------- ### Get Tenant - JSON response Source: https://docs.laserdata.com/organization Example response from the Get Tenant endpoint. The 'features' object reports current limits and enabled capabilities; 'deployment_tiers' lists allowed tiers and their maximum deployment counts. 'starter_available' indicates whether another Free tier deployment can be created. ```json { "id": 1, "name": "Acme Corp", "protected": false, "created_at": "2025-01-10T08:00:00Z", "updated_at": "2025-06-15T12:30:00Z", "description": "Main production tenant", "email": "admin@acme.com", "features": { "invitations_limit": 100, "members_limit": 100, "roles_limit": 20, "divisions_limit": 5, "environments_limit": 20, "deployment_tiers": [ { "tier": "free", "limit": 1 }, { "tier": "small", "limit": 3 }, { "tier": "medium", "limit": 3 }, { "tier": "large", "limit": 2 }, { "tier": "xlarge", "limit": 1 }, { "tier": "2xlarge", "limit": 1 } ], "deployment_access_rules_limit": 10, "deployment_configs_limit": 5, "deployment_backups_limit": 3, "deployment_snapshots_limit": 5, "private_connections_limit": 3, "private_endpoints_limit": 1, "byoc_enabled": true, "cluster_enabled": true, "on_premise_enabled": false, "private_networking_enabled": true, "multi_az_enabled": true, "dedicated_enabled": false, "backup_enabled": true, "cross_region_dr_enabled": false, "audit_retention_days": 30, "api_keys_limit": 10, "cloud_accounts_limit": 5, "notification_channels_limit": 5, "notification_subscriptions_limit": 10, "custom_domains_limit": 1, "backup_regions_limit": 3, "nodes_per_deployment_limit": 5, "backup_retention_days": 30, "snapshot_retention_days": 14, "pending_invitations_limit": 100, "api_key_allowed_ips_limit": 20, "divisions_per_role_limit": 3, "environments_per_division_limit": 3, "concurrent_deployments_limit": 2, "audit_export_enabled": true, "advanced_connectors_enabled": true, "customer_managed_keys_enabled": false, "advanced_notification_channels_enabled": true }, "subscription": { "id": 1, "plan": "pro", "active": true, "created_at": "2025-01-10T08:00:00Z", "valid_from": "2025-01-10T08:00:00Z", "valid_to": "2026-01-10T08:00:00Z" }, "starter_available": true, "has_payment_method": true } ``` -------------------------------- ### Clone laser-sdk repository Source: https://docs.laserdata.com/laser-sdk/laser-stack Clones the laser-sdk repository to run the SDK examples. ```bash git clone https://github.com/laserdata/laser-sdk ``` -------------------------------- ### Session output Source: https://docs.laserdata.com/laser-sdk/quickstart Shows the expected output of the session recording program: the session start, the agent message, the triaged reply, and the session completion. ```plaintext session.started agent.message disk full on node-7 agent.message triaged: disk full on node-7 session.completed ``` -------------------------------- ### create(label) Source: https://docs.laserdata.com/laser-sdk/session Derives the session ID from the stream, namespace, and label, so the same label always reaches the same session. Requires `.agent(id)` for the agent that owns the session, then `begin()` writes the start record and returns the session with a lease. ```APIDOC ## create(label) ### Description Derives the session ID from the stream, namespace, and label, so the same label always reaches the same session. Requires `.agent(id)` for the agent that owns the session, then `begin()` writes the start record and returns the session with a lease. ### Parameters - **label** (string) - Required - Label used to derive the session ID. - **agent(id)** (AgentId) - Required - Agent that owns the session. ### Returns - **session** - The session object. - **lease** - The lease that keeps the session listed in the client's heartbeat while your process works on it. ``` -------------------------------- ### Rust: Start session and end or fail with guard Source: https://docs.laserdata.com/laser-sdk/session Starts a session with a fresh ID, runs work, and ends it as completed or failed. Uses `AgentErrorBody` and `AgentErrorCode` from `laser_sdk::prelude::full`. The lease is dropped after the match. ```Rust let (session, lease) = sessions.start().agent("triage".parse::()?).begin().await?; match triage(&session).await { Ok(()) => session.end().await?, Err(error) => { let body = AgentErrorBody { code: AgentErrorCode::Internal, message: Some(error.to_string()), retryable: false, detail: None, }; session.fail(body).await?; } } drop(lease); ``` -------------------------------- ### Install laser CLI via curl Source: https://docs.laserdata.com/cli Downloads and runs the installer script from cli.laserdata.cloud. The installer detects OS and architecture, verifies SHA-256 checksum, and installs to $HOME/.local/bin or $LD_PREFIX. Re-run to upgrade. ```bash curl -fsSL https://cli.laserdata.cloud/install.sh | sh ``` -------------------------------- ### Python: Start session and end or fail with guard Source: https://docs.laserdata.com/laser-sdk/session Starts a session with a fresh ID, runs work, and ends it as completed or failed. The failure body is a dict with `code` as the wire number, 7 for `Internal`. The lease is released in a finally block. ```Python session, lease = await sessions.start().agent("triage").begin() try: await triage(session) await session.end() except Exception as error: await session.fail({"code": 7, "message": str(error), "retryable": False}) raise finally: lease.release() ``` -------------------------------- ### Delegate work to a child session (Rust) Source: https://docs.laserdata.com/laser-sdk/session Starts a child session with a specialist agent, passing the parent conversation as both parent and root. The child lives in the same stream and its history stays in the child. Use the returned lease to run the child and call tools. ```Rust let (child, lease) = sessions .start() .agent("specialist".parse::()?) .parent(id, id) .begin() .await?; child .run(lease, |child| async move { let tool = child.tool("inspect_service", json!({ "service": "api" })).await?; tool.complete(b"cache saturation".to_vec()).await?; Ok(()) }) .await?; ``` -------------------------------- ### Delegate work to a child session (Python) Source: https://docs.laserdata.com/laser-sdk/session Starts a child session with a specialist agent, passing the parent conversation as both parent and root. The child lives in the same stream and its history stays in the child. Use the async context manager to run the child and call tools. ```Python child_builder = sessions.start().agent("specialist").parent(session.conversation, session.conversation) async with child_builder as child: tool = await child.tool("inspect_service", {"service": "api"}) await tool.complete("cache saturation") ``` -------------------------------- ### Verify installation with laser version Source: https://docs.laserdata.com/cli Displays the installed version of the laser CLI. ```bash laser version ``` -------------------------------- ### create(label) / start() Source: https://docs.laserdata.com/laser-sdk/advanced/sessions Starts a new session. Both create(label) and start() return a builder that can be chained with settings and then begin() is called to write the start record and return the session with a lease. ```APIDOC ## create(label) / start() ### Description Starts a new session. Both `create(label)` and `start()` return a builder that can be chained with settings and then `begin()` is called to write the start record and return the session with a lease. ### Method Builder method ### Endpoint N/A (SDK method) ### Parameters #### Builder Settings - **agent(id)** (required) - Sets the owning agent. - **namespace(ns)** - Sets the namespace for a labeled ID. - **parent(parent, root)** - Sets parent and root for a child session. - **with_id(id)** - Sets an explicit ID. - **idle_timeout(Duration)** - Sets the idle timeout. - **budget(Budget { .. })** - Sets the budget. - **tag(tag)** - Adds a searchable tag (repeatable). ### Response #### Success Response - **Rust**: Returns `(Session, SessionLease)`. - **TypeScript**: Returns `{ session, lease }`. - **Python**: Returns a `(session, lease)` tuple. #### Error Response - A builder without an agent fails with an invalid error. ### Limits - Label: 256 bytes of valid UTF-8, no control characters - Namespace: 128 bytes, the key-value namespace rule - Tags: 16 tags of at most 64 bytes each ``` -------------------------------- ### POST /tenants/{tenant_id}/divisions/{division_id}/deployments/starter Source: https://docs.laserdata.com/deployments Creates a Free starter deployment for testing purposes. Returns 202 Accepted with ld-environment and ld-deployment headers on success. ```APIDOC ## [POST] /tenants/{tenant_id}/divisions/{division_id}/deployments/starter ### Description Creates a Free starter deployment for testing. ### Method POST ### Endpoint https://api.laserdata.cloud/tenants/{tenant_id}/divisions/{division_id}/deployments/starter ### Parameters #### Path Parameters - **tenant_id** (string) - Required - Tenant identifier - **division_id** (string) - Required - Division identifier #### Request Body - **cloud** (string) - Required - `aws` or `gcp` - **region** (string) - Required - Cloud region - **environment_id** (string) - Optional - Existing environment to deploy into - **environment_name** (string) - Optional - Name for a new environment. Defaults to `sandbox` when neither an ID nor a name is given - **deployment_name** (string) - Optional - Deployment name. Generated when omitted ### Response #### Success Response (202 Accepted) - **ld-environment** (header) - Environment identifier - **ld-deployment** (header) - Deployment identifier ### Request Example ``` curl -X POST https://api.laserdata.cloud/tenants/{tenant_id}/divisions/{division_id}/deployments/starter \ -H "ld-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "cloud": "aws", "region": "us-west-1" }' ``` ``` -------------------------------- ### start() Source: https://docs.laserdata.com/laser-sdk/advanced/sessions Starts a session with a fresh, unique ID. ```APIDOC ## start() ### Description Starts a session with a fresh, unique ID. ### Method start ``` -------------------------------- ### Get My IP - Example Response Source: https://docs.laserdata.com/api/networking Example JSON response from the Get My IP endpoint, showing the caller's observed IPv4 address and whether an existing rule covers it on Iggy HTTP. ```json { "ip_address": "203.0.113.7", "refusal": null, "covered_by": null } ``` -------------------------------- ### Get Billing Info - Response Source: https://docs.laserdata.com/api/billing Example JSON response from the Get Billing Info endpoint. ```json { "name": "John Doe", "company": "Acme Corp", "address": "123 Main St", "city": "San Francisco", "state": "CA", "postal_code": "94105", "country": "US", "tax_id": "US123456789", "email": "billing@acme.com", "phone": "+1-555-0100" } ``` -------------------------------- ### Get Cloud Account Details response JSON Source: https://docs.laserdata.com/organization/cloud-accounts Example response from the Get Cloud Account Details endpoint. Includes settings and remarks fields, which are omitted in list responses. ```json { "id": 1, "cloud": "aws", "name": "production-aws", "account_id": "123456789012", "region": "us-west-1", "status": "active", "created_at": "2026-06-01T10:00:00Z", "updated_at": "2026-06-01T10:00:00Z", "settings": { "aws": { "identity_arn": "arn:aws:iam::123456789012:role/LaserDataRole", "external_id": "unique-external-id", "vpc_id": "vpc-0abc123def456", "vpc_cidr": "10.0.0.0/16" } }, "remarks": "Main production AWS account" } ``` -------------------------------- ### Python: Record a session with model and tool calls Source: https://docs.laserdata.com/laser-sdk/session Bootstrap a stream, create a session, record a model call and a tool call, set state, and read back the session context. The SDK never calls a model; your code calls its provider and records the answer. The read prints session.started, model.request, context.assembled, model.response, tool.call, tool.result, state.updated twice, and session.completed. ```Python import asyncio import laser_sdk as ls async def main(): async with await ls.Laser.connect_env() as laser: sessions = laser.sessions(stream="ops") await sessions.bootstrap(4, ls.TopicRetention.expire_after(7 * 86_400_000)) async with sessions.create("incident-42").agent("triage") as session: assembled = await session.assemble(ls.LastN(20)) call = await session.model(ls.ModelRequest("gpt-4o", assembled.text()), assembled) # Call your model provider here, then record its answer. await call.complete( ls.ModelResponse("Check the cache on node-7", usage={"input_tokens": 812, "output_tokens": 64}) ) tool = await session.tool("read_metrics", {"host": "node-7"}) await tool.complete("cache hit rate 41%") await session.state().set("status", "triaged") for turn in await sessions.open(session.conversation).context(): print(turn.display, turn.text()) asyncio.run(main()) ``` -------------------------------- ### bootstrap(partitions, retention) Source: https://docs.laserdata.com/laser-sdk/session Creates the session topic `agent.sessions` and other agent topics in the stream. Run once per stream before the first session. On Laser Stack and LaserData Cloud, it also registers the stream so managed session reads can see it. ```APIDOC ## bootstrap(partitions, retention) ### Description Creates the session topic `agent.sessions` and other agent topics in the stream. Run once per stream before the first session. On Laser Stack and LaserData Cloud, it also registers the stream so managed session reads can see it. ### Parameters - **partitions** (type not specified) - Required - Number of partitions for the session topic. - **retention** (type not specified) - Required - Retention period for the session topic, required because `agent.sessions` holds every session's records. ``` -------------------------------- ### Reset and start with random password Source: https://docs.laserdata.com/laser-sdk/laser-stack Resets the stack data and starts with a random password. Required before using --random-password if an Iggy volume exists or LASER_IGGY_PASSWORD is set in the shell. ```bash ./scripts/reset --yes ./scripts/up --random-password ``` -------------------------------- ### sessions().open(id).context() Source: https://docs.laserdata.com/laser-sdk/fabric Reads the session back using its ID. Returns the session context. ```APIDOC ## sessions().open(id).context() ### Description Reads the session back using its ID. Returns the session context. ### Method open ### Endpoint laser.sessions().open(id).context() ### Parameters - **id** (SessionId) - Required - The ID of the session to open. ### Response - **context** (SessionContext) - The context of the session. ``` -------------------------------- ### begin() Source: https://docs.laserdata.com/laser-sdk/advanced/sessions Write the start record and return the session and its lease. ```APIDOC ## begin() ### Description Write the start record and return the session and its lease. ### Method Function ### Endpoint `begin()` ### Parameters None. ### Response Returns the session and its lease. ``` -------------------------------- ### Get Peering Setup Instructions - curl Source: https://docs.laserdata.com/api/networking Gets step-by-step instructions tailored to the current peering status, including the peering request ID to accept in the AWS Console. Requires deployment:network:read permission. ```bash curl {supervisor_url}/deployments/{deployment_id}/network/aws/vpc_peering/{peering_id}/instructions \ -H "ld-api-key: YOUR_API_KEY" ``` -------------------------------- ### Get Division Agent (Supervisor API) - example response Source: https://docs.laserdata.com/api/deployments Example JSON response for the Get Division Agent endpoint. `cards` holds the agent's card on every agentic stream (empty if only known from a live connection); `connections` lists live connections. `observed_at` is null for a quarantined agent without a current card. An agent with neither a card nor a connection returns 404 `agent_not_found`. ```json { "deployment_id": 31842260173701121, "environment_id": 1201, "deployment_name": "telemetry-eu", "agent_id": "triage-agent", "cards": [ { "stream_id": 3, "stream_created_at": "2026-10-13T12:00:00.123456Z", "stream_name": "support-agents", "name": "Triage", "version": "1.4.0", "skills": [ { "skill_id": "summarize", "health": "healthy", "load": 250, "max_concurrency": 4 } ], "quarantined": false, "observed_at": "2026-10-26T08:12:30.123456Z", "expires_at": "2026-10-26T08:22:30.123456Z", "active_sessions_count": 1, "synced_at": "2026-10-26T08:13:00Z" } ], "connections": [ { "node_id": 1, "client_id": 42, "user_id": 5, "transport": "tcp", "address": "10.0.4.17:51522", "inbox": "triage.work", "first_seen_at": "2026-10-26T07:58:12.413000Z", "confirmed_at": "2026-10-26T08:14:00Z" }, { "node_id": 2, "client_id": 17, "user_id": 5, "transport": "quic", "address": "10.0.5.23:40112", "inbox": "triage.work", "first_seen_at": "2026-10-26T08:01:40.002000Z", "confirmed_at": "2026-10-26T08:13:55Z" } ], "active_sessions_count": 1, "last_seen_at": "2026-10-26T08:14:00Z" } ``` -------------------------------- ### Get Tenant Structure Response (JSON) Source: https://docs.laserdata.com/organization Example response for the tenant structure request. Shows the nested divisions, environments, and deployments structure. ```json { "id": 1, "name": "Acme Corp", "divisions": [ { "id": 1, "name": "Platform Engineering", "environments": [ { "id": 1, "name": "production", "deployments": [ { "id": 1, "name": "prod-cluster", "cloud": "aws", "region": "us-west-1", "variant": "managed", "tier": "large", "supervisor_url": "https://supervisor-aws-us.laserdata.cloud" } ] } ] } ] } ``` -------------------------------- ### laser deployment provisioning commands Source: https://docs.laserdata.com/cli/commands Provisioning commands: preview, create-managed, create-byoc, and create-starter. preview returns pricing without creating resources. Paid create-managed requires --managed-tier and --cluster cluster. --tier selects compute size; --target-network-tput sets throughput estimate. On interactive terminals, missing required flags prompt for input. create-starter creates a Free deployment for testing. ```bash laser deployment preview \ [--cloud aws|gcp] [--region REGION] [--managed-tier standard|performance|enterprise] [--tier SIZE] \ [--storage-type network_balanced|local_ssd] [--storage-size-gb N] [--target-network-tput KBPS] \ [--network-scope same_region|cross_region_same_cloud|cross_cloud] [--availability-mode single_az|multi_az] ``` ```bash laser deployment create-managed \ [--name NAME] [--cloud aws|gcp] [--region REGION] \ [--managed-tier standard|performance|enterprise] [--tier SIZE] [--cluster standalone|cluster] \ [--storage-type network_balanced|local_ssd] [--storage-size-gb N] [--target-network-tput KBPS] \ [--network-scope same_region|cross_region_same_cloud|cross_cloud] [--availability-mode single_az|multi_az] \ [--protected true|false] [--encrypted true|false] [--dedicated true|false] \ [--public-ip-enabled true|false] [--subdomain-enabled true|false] \ [--telemetry-days N] [--spend-limit USD] ``` ```bash laser deployment create-byoc \ [--name NAME] [--cloud aws|gcp] [--region REGION] [--tier SIZE] [--cluster standalone|cluster] \ [--storage-type network_balanced|local_ssd] [--storage-size-gb N] [--availability-mode single_az|multi_az] \ [--protected true|false] [--encrypted true|false] \ [--public-ip-enabled true|false] [--subdomain-enabled true|false] \ [--telemetry-days N] [--spend-limit USD] \ [--aws-account-id ID] [--aws-identity-arn ARN] [--aws-external-id ID] [--aws-vpc-id ID] [--aws-vpc-cidr CIDR] \ [--gcp-project-id ID] [--gcp-service-account-email EMAIL] [--gcp-vpc-name NAME] ``` ```bash laser deployment create-starter \ [--cloud aws|gcp] [--region REGION] \ [--environment-id ID | --environment-name NAME] [--deployment-name NAME] ``` -------------------------------- ### List Notification Types response Source: https://docs.laserdata.com/api/notifications Example JSON response from the GET /notifications/types endpoint, showing available event types. ```json [ { "type": "deployment_created", "name": "Deployment created" }, { "type": "deployment_initialized", "name": "Deployment initialized" }, { "type": "high_cpu_usage", "name": "High CPU usage" }, { "type": "node_unreachable", "name": "Node unreachable" } ] ``` -------------------------------- ### Record a session in TypeScript Source: https://docs.laserdata.com/laser-sdk/quickstart Opens a session as 'intake', sends a contract to 'triage' with the session conversation, ends the session, and reads back its context. Prints each turn, showing the text for agent messages. Requires the @laserdata/laser-sdk package. ```TypeScript import { sessionTurnText } from "@laserdata/laser-sdk" const { session } = await laser.sessions().start().agent(AgentId.new("intake")).begin() await laser .contract(routeTo(AgentId.new("triage"))) .from(AgentId.new("intake")) .payload(text.encode("disk full on node-7")) .inboxRoute({ kind: "fixed", topic: AgentTopic.Sessions }) .conversation(session.conversation) .send() await session.end() for (const turn of await session.context()) { console.log(turn.display, turn.display === "agent.message" ? sessionTurnText(turn) : "") } ``` -------------------------------- ### Rust: Record a session with model and tool calls Source: https://docs.laserdata.com/laser-sdk/session Bootstrap a stream, create a session, record a model call and a tool call, set state, and read back the session context. The SDK never calls a model; your code calls its provider and records the answer. In Rust, sessions need the `agent` feature. The read prints session.started, model.request, context.assembled, model.response, tool.call, tool.result, state.updated twice, and session.completed. ```Rust use laser_sdk::agent::{ModelRequest, ModelResponse}; use laser_sdk::prelude::full::*; use laser_sdk::wire::agent::TokenUsage; use serde_json::json; use std::time::Duration; #[tokio::main] async fn main() -> Result<(), LaserError> { let laser = Laser::connect_env().await?; let sessions = laser.sessions_with(SessionConfig::new().stream("ops")); sessions .bootstrap(4, TopicRetention::expire_after(Duration::from_secs(7 * 86_400))) .await?; let (session, lease) = sessions.create("incident-42").agent("triage".parse::()?).begin().await?; let id = session.conversation(); 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?; // Call your model provider here, then record its answer. call.complete(ModelResponse { body: b"Check the cache on node-7".to_vec(), usage: Some(TokenUsage { input_tokens: 812, output_tokens: 64, ..Default::default() }), ..Default::default() }) .await?; let tool = session.tool("read_metrics", json!({ "host": "node-7" })).await?; tool.complete(b"cache hit rate 41%".to_vec()).await?; session.state().set("status", json!("triaged")).await?; Ok(()) }) .await?; for turn in sessions.open(id).context().await? { println!("{} {}", turn.display, turn.text()); } Ok(()) } ``` -------------------------------- ### join() Source: https://docs.laserdata.com/laser-sdk/fabric Waits for the agent to stop on its own. ```APIDOC ## join() ### Description Waits for the agent to stop on its own. ### Method join() ### Parameters None ### Response None ``` -------------------------------- ### List All Configurations - curl Source: https://docs.laserdata.com/deployments/configuration Lists all configurations for the iggy kind. ```bash curl {supervisor_url}/deployments/{deployment_id}/configs/iggy \ -H "ld-api-key: YOUR_API_KEY" ```