API Reference
Routed Search
Send a question to the knowledge source best suited to answer it, and get the answer plus the routing decision.
Endpoint and request fields
POST/memory/search/routed
200 OK
| Field | Type | Contract |
|---|---|---|
query | string | Required question. |
k | integer | Optional result ceiling. |
route | string | Optional explicit route, bypassing automatic selection. |
include_reasoning | boolean | Optional; include why that route was chosen. |
Ask a routed question
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",project_id=os.environ["MEMORYSYNC_PROJECT_ID"],end_user_id="usr_7f3a9c2e",)result = client.search_routed("What did we decide about the pricing tiers?", include_reasoning=True)
Result handling
Expect the chosen route, the answer or matched records, and — when requested — the reasoning behind the choice.
Errors and next action
Correct 4xx request problems. An unknown explicit route is a 422. For 429 or 5xx, fall back to Query, which does no routing.