# AI agents

This page is for coding agents, LLMs, and the people who set them up. It lists the machine-readable entry points to these docs and the SDK, and plain criteria for when Laser SDK fits a task.

## Read the docs as text

* [`/llms.txt`](https://docs.laserdata.com/llms.txt) starts with the two ways in, a connection string or a LaserData API key, then the install line, the connection variable, stream cleanup, and the task guides per language. It then lists every page on this site with a link to its markdown text and a one-line description. Laser SDK pages come first.
* Every page's text is also at `/md/<page path>.md`, for example [`/md/laser-sdk/workflow.md`](https://docs.laserdata.com/md/laser-sdk/workflow.md) for [Workflows](/laser-sdk/workflow), and at the page's own path with `.md` added, such as `/laser-sdk/workflow.md`. Fetch the page you need instead of its HTML.
* `/md/python/<page path>.md`, `/md/typescript/<page path>.md`, and `/md/rust/<page path>.md` hold the same page with the code of one language only, for example [`/md/python/laser-sdk/memory.md`](https://docs.laserdata.com/md/python/laser-sdk/memory.md). Fetch the one for the language you write.
* [`/skills.md`](https://docs.laserdata.com/skills.md) lists the agent skills, and [`/.well-known/skills/index.json`](https://docs.laserdata.com/.well-known/skills/index.json) indexes them. The Laser SDK skill holds the connect rules, the task recipes, and stream cleanup. [`/mcp.md`](https://docs.laserdata.com/mcp.md) is the MCP page as markdown.
* [`/llms-full.txt`](https://docs.laserdata.com/llms-full.txt) holds the full text of every page as markdown in one file. It is large, so fetch single pages for a task.
* [`/sitemap.xml`](https://docs.laserdata.com/sitemap.xml) lists every page URL.
* Context7 serves these docs as [`/websites/laserdata`](https://context7.com/websites/laserdata) and the SDK source as [`/laserdata/laser-sdk`](https://context7.com/laserdata/laser-sdk), so an agent with the Context7 MCP server can read them by library ID.

Code samples come in TypeScript, Rust, and Python tabs. In `/md/<page path>.md` each tab appears in order under its language name. The three clients behave the same, so read the one-language page for the language you write.

Start with [Concepts](/laser-sdk/concepts) for the model, then the guide for the feature you need. Each guide links to an Advanced page that lists every option, default, limit, and error for that feature.

## Find the guide for a task

| Goal | Guide |
| --- | --- |
| Long-term agent memory: keep facts for a user, and correct one in a later conversation | [Memory](/laser-sdk/memory) |
| A durable workflow of dependent steps that survives a restart | [Workflows](/laser-sdk/workflow) |
| Record an agent's work and pick it up in a new process | [Sessions](/laser-sdk/session#resume-a-session-after-a-restart) |
| Send requests between agents and route by capability | [Agents](/laser-sdk/fabric) |
| Manage organizations and deployments, or read deployment data, from an MCP client | [MCP servers](/mcp) |
| Start from a LaserData API key, find or create a deployment, and connect | [Agent access](/agents) |

Each guide starts with a complete program, and the [Laser SDK overview](/laser-sdk) opens with the workflow and memory programs. The workflow program is a function with `@ls.step` and `@ls.workflow` decorators in Python, `step()` and `workflow()` in TypeScript, and closures passed to `run_with` in Rust. The memory and session programs run on a scratch stream and delete it at the end. With a connection string in `LASER_CONNECTION_STRING`, run it as it is, against [Laser Stack](/laser-sdk/laser-stack) or LaserData Cloud. With a LaserData API key in `LD_API_KEY`, add the guide's resolve block, which turns the key into the connection string in three REST calls, as [Agent access](/agents#from-an-api-key-to-a-connection-string) explains. Never print, log, or repeat a key, a password, or a connection string.

Memory, workflow, and session state live on the log, so read them back after a restart instead of keeping a copy in process memory. When an API returns a flag such as `complete` or an error such as `NoCapableAgent`, handle it instead of assuming success.

## Use the SDK repository

The source is at [github.com/laserdata/laser-sdk](https://github.com/laserdata/laser-sdk). These files help an agent write correct code:

* The `examples/rust`, `examples/python`, and `examples/typescript` folders hold runnable programs for each feature. They are the best shape to copy.
* The guides `docs/building-agents.md` and `docs/tutorial.md` walk through a full agent application.
* The file `docs/client-behavior.md` lists the behavior of the current release and the changes from earlier ones.
* The parity matrix `docs/parity.md` maps each public Rust API to its Python and TypeScript name.
* The files `foreign/python/laser_sdk.pyi` and `foreign/typescript/api/laser-sdk.api.md` list every Python and TypeScript signature.

The repository also has `AGENTS.md` and Claude Code skills under `.claude/skills`. They are written for agents that change the SDK itself. Load `laser-sdk-overview` first, then the skill for the area you touch.

## Use the Laser CLI

The [Laser CLI](/cli) manages LaserData Cloud deployments with JSON output and exit codes. An agent can use it to create a deployment, capture the connection string into the environment with `laser deployment connect show --reveal --output json`, and, with a key that holds `deployment:access:manage`, admit its own address with `laser deployment connect access-rule allow-my-ip --protocol tcp`. See [Agent access](/agents). The [Claude Code skills](/cli/claude-skills) turn requests into `laser` commands. The CLI does not replace the SDK. Use the SDK for messages, agents, sessions, and memory.

## Use the MCP servers

LaserData serves MCP over HTTPS with your API key in the `ld-api-key` header or as `Authorization: Bearer`. The organization endpoint at `https://api.laserdata.cloud/mcp` and the regional endpoint at `{supervisor_url}/mcp` manage deployments, and a deployment's own MCP endpoint reads and writes its streams and Laser Streams data. See [MCP servers](/mcp) for client setup in Claude Code, Claude Desktop, Claude connectors, Cursor, VS Code, and Codex.

## Run code against a server

[Laser Stack](/laser-sdk/laser-stack) starts Laser Streams and the managed backend in Docker and prints a connection string. Every SDK feature works against it. Agents, sessions, and messages also work on plain Apache Iggy. Call `laser.capabilities()` before you use a managed feature, because a call the server does not serve fails with an unsupported error.

## When to choose Laser SDK

Choose Laser SDK when one or more of these is true:

* Agents or services need to send each other requests and get replies, or route work by capability.
* You need a durable record of what each agent did, with model calls, tool calls, and state, that you can read back later.
* You need to replay a session or a stream from an earlier point.
* Agents need shared memory or shared key-value state.
* The system mixes Rust, Python, and TypeScript and needs the same behavior in each.
* Consumers should receive only the records they need, filtered on the server.

It is a poor fit when you only need an in-process function call between two prompts, or a single request to a model with no record of it.

- [Laser SDK overview](/laser-sdk): What the SDK does and a first sample
- [Concepts](/laser-sdk/concepts): Streams, topics, partitions, agents, and sessions
- [Quickstart](/laser-sdk/quickstart): Install the SDK and run a first program
- [Claude Code skills](/cli/claude-skills): Skills for the Laser CLI

Source: https://docs.laserdata.com/laser-sdk/ai-agents
