MossSimSearch wraps a Moss index and returns results in sim.ai’s expected shape — ready to serve from a webhook that sim.ai calls as an external HTTP tool.
Note: For a complete FastAPI server and setup guide, see the sim.ai cookbook.
How it works
sim.ai workflows call external HTTP tools. You run a small webhook server backed byMossSimSearch and point an HTTP tool node at it. When the workflow triggers the tool, Moss answers in under 10 ms and the result flows back into the workflow.
Required tools
- Moss Portal project with credentials
- Python 3.10+
- uv (optional but recommended)
- A sim.ai workspace with a deployed workflow
Integration guide
Installation
Install If you are using the cookbook example, you can sync the dependencies directly using
sim-moss along with FastAPI and Uvicorn:uv:Environment setup
Set your Moss credentials as environment variables. You can create a
.env file or export them directly:Serve from a webhook
Wrap the search in a FastAPI webhook server:Start the webhook server locally using The server pre-loads the Moss index on startup. Check
uvicorn (or uv run uvicorn):/health to confirm readiness.API
POST /search
Request
GET /health
Returns {"status": "ok", "index_loaded": true} once the index is warm.
Configuration
MossSimSearch
| Parameter | Default | Description |
|---|---|---|
project_id | MOSS_PROJECT_ID env var | Moss project ID (required) |
project_key | MOSS_PROJECT_KEY env var | Moss project key (required) |
index_name | MOSS_INDEX_NAME env var or "sim-docs" | Name of the Moss index to query |
top_k | MOSS_TOP_K env var or 5 | Number of results to retrieve per query |
alpha | 0.8 | Blend: 1.0 = semantic only, 0.0 = keyword only |
SimSearchResult
| Field | Type | Description |
|---|---|---|
results | list[dict] | Documents with content, score, and optional source |
time_taken_ms | int | None | Moss query latency in milliseconds |