# `slop-ai`
Rust SDK for SLOP (State Layer for Observable Programs).
Expose application state as a structured tree that AI agents can subscribe to, inspect, and act on over WebSocket, Unix socket, stdio, or Axum-backed endpoints.
[](https://crates.io/crates/slop-ai)
[](https://docs.rs/slop-ai)
## Installation
```sh
cargo add slop-ai
```
For Axum integration:
```sh
cargo add slop-ai --features axum
```
## Quick start
```rust
use serde_json::json;
use slop_ai::SlopServer;
let slop = SlopServer::new("my-app", "My App");
slop.register("todos", json!({
"type": "collection",
"props": { "count": 1 },
"items": [
{ "id": "1", "props": { "title": "Ship docs", "done": false } }
]
}));
```
## Feature flags
| `native` | Yes | Enables the native transport set |
| `websocket` | No | WebSocket provider and client support |
| `unix` | No | Unix socket provider and client support |
| `stdio` | No | Stdio transport for CLI and subprocess workflows |
| `axum` | No | Axum WebSocket integration |
## Documentation
- Project API page: https://docs.slopai.dev/api/rust
- Rust guide: https://docs.slopai.dev/guides/rust
- docs.rs: https://docs.rs/slop-ai
## Discovery layer
The Rust SDK includes the core discovery layer in `slop_ai::discovery` under the default `native` feature set:
```rust
use slop_ai::discovery::{DiscoveryService, DiscoveryServiceOptions};
#[tokio::main]
async fn main() {
let service = DiscoveryService::new(DiscoveryServiceOptions::default());
service.start().await;
if let Ok(Some(provider)) = service.ensure_connected("my-app").await {
println!("{}", provider.name);
}
service.stop().await;
}
```