Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion content/develop/ai/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ AI agents are autonomous systems that combine LLMs with memory, tools, and plann

### Context Engine services

The [Context Engine]({{< relref "/develop/ai/context-engine" >}}) (Redis Iris) includes four services, available fully managed on Redis Cloud or self-managed on your own infrastructure:
The [Context Engine]({{< relref "/develop/ai/context-engine" >}}) (Redis Iris) includes these services, available fully managed on Redis Cloud or self-managed on your own infrastructure:

- [LangCache]({{< relref "/develop/ai/context-engine/langcache" >}}): Semantic caching that reduces LLM API costs and improves response times by reusing cached responses for similar queries.
- [Redis Agent Memory]({{< relref "/develop/ai/context-engine/agent-memory" >}}): Two-tier persistent memory (session and long-term) for agents, available through Python and TypeScript SDKs and a REST API.
- [Context Gateway]({{< relref "/develop/ai/context-engine/context-gateway" >}}): Gives agents one Model Context Protocol (MCP) endpoint for the tools of any MCP server, and serves your Redis data as tools with Context Surfaces.
- [Intent Router]({{< relref "/develop/ai/context-engine/intent-router" >}}): Classifies a user's message into an intent you define and returns the target to dispatch to, with no LLM call. Self-managed on Kubernetes.
- [Data Integration]({{< relref "/develop/ai/context-engine/data-integration" >}}): Keeps your Redis Cloud database in sync with relational databases in near real time using Change Data Capture.

## How to's
Expand Down Expand Up @@ -140,6 +141,7 @@ The Context Engine provides managed services for agent memory and data access.
* [Get started with LangCache]({{< relref "/develop/ai/context-engine/langcache" >}}): Add semantic caching to reduce LLM costs in minutes.
* [Get started with Agent Memory]({{< relref "/develop/ai/context-engine/agent-memory" >}}): Add persistent two-tier memory to any agent using the REST API.
* [Get started with Context Gateway]({{< relref "/develop/ai/context-engine/context-gateway" >}}): Give agents one MCP endpoint for the tools of your MCP servers and your Redis data.
* [Get started with Intent Router]({{< relref "/develop/ai/context-engine/intent-router" >}}): Route each request to the right tool or agent by matching it to intents you define.
* [Get started with Data Integration]({{< relref "/develop/ai/context-engine/data-integration" >}}): Keep Redis in sync with your primary database so agents always have fresh data.

## Tutorials
Expand Down
6 changes: 3 additions & 3 deletions content/develop/ai/context-engine/intent-router/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For example, a support application can route "where is my package?" to a `track_
- **Tunable strictness:** Set a minimum score on the Router, on each intent, or on a single request.
- **Safe updates:** Replacing an intent never leaves it empty while queries are in flight, and conditional writes prevent lost updates.
- **Governed access:** Each Router is its own authorization boundary, with separate `read`, `write`, and `full` grants.
- **Flexible integration:** Use Python, TypeScript, the `iris` command-line interface (CLI), or the Hypertext Transfer Protocol (HTTP) API.
- **Flexible integration:** Use Python, the `iris` command-line interface (CLI), or the Hypertext Transfer Protocol (HTTP) API.

## Choose how to use it

Expand All @@ -60,9 +60,9 @@ pip install redis-iris

Set `IRIS_INTENT_ROUTER_URL`, `IRIS_INTENT_ROUTER_ID`, and `IRIS_INTENT_ROUTER_API_KEY` as shown in the [quickstart](/content/develop/ai/context-engine/intent-router/quickstart.md#save-connection-values), connect, and define intents:

{{< clients-example set="iris_intent_router_quickstart" step="intents-create" description="" lang_filter="Python (Iris),TypeScript (Iris),cURL (Iris),CLI (Iris)" footer="hide" />}}
{{< clients-example set="iris_intent_router_quickstart" step="intents-create" description="" lang_filter="Python (Iris),cURL (Iris),CLI (Iris)" footer="hide" />}}

The [redis-iris package](https://pypi.org/project/redis-iris/) covers matching, intent authoring, and Router administration in Python and the CLI. For TypeScript, the generated client [@redis-iris/intent-router](https://www.npmjs.com/package/@redis-iris/intent-router) covers the data plane and the control plane. See the [developer guide](/content/develop/ai/context-engine/intent-router/developer-guide.md) to choose a client.
The [redis-iris package](https://pypi.org/project/redis-iris/) covers matching, intent authoring, and Router administration in Python and the CLI. See the [developer guide](/content/develop/ai/context-engine/intent-router/developer-guide.md) to choose a client.

## Get started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Two credentials guard the service:
- An **admin token** manages Routers on the control plane. Platform teams hold it.
- An **agent key** authenticates an application's data-plane requests as a bearer token. It carries a grant for each Router it can use. Redis Iris issues agent keys through its Identity Service, not through the Intent Router API.

A grant lists one or more actions on one Router. A key without the action an operation needs gets `403`.
A grant lists one or more actions on one Router. The data plane refuses a request from a key without the action the operation needs.

| Action | What it allows |
| ------ | -------------- |
Expand Down
18 changes: 8 additions & 10 deletions content/develop/ai/context-engine/intent-router/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ categories:
- docs
- develop
- ai
description: Connect an application to Redis Intent Router and work with intents through Python, TypeScript, the Iris CLI, or HTTP.
description: Connect an application to Redis Intent Router and work with intents through Python, the Iris CLI, or HTTP.
hideListLinks: true
linktitle: Developer guide
title: Redis Intent Router developer guide
weight: 5
---

Use the Python package, the TypeScript client, the Iris command-line interface (CLI), or Hypertext Transfer Protocol (HTTP) requests to author intents, match queries, and administer Routers.
Use the Python package, the Iris command-line interface (CLI), or Hypertext Transfer Protocol (HTTP) requests to author intents, match queries, and administer Routers.

## Integration workflow

Expand All @@ -26,12 +26,11 @@ Platform teams create the Router and the agent keys. See [Manage Routers](/conte

| Client | Use it when | Package and guide |
|:-------|:------------|:------------------|
| Python | Your application or agent uses Python. | Install [`redis-iris`](https://pypi.org/project/redis-iris/) and follow the [quickstart](/content/develop/ai/context-engine/intent-router/quickstart.md). `IntentRouter` exposes the data-plane operations through its `client` property, and its `service` property administers Routers. |
| TypeScript | Your application or agent uses JavaScript or TypeScript. | Install [`@redis-iris/intent-router`](https://www.npmjs.com/package/@redis-iris/intent-router). `IntentRouter` calls the data plane, and `IntentRouterService` calls the control plane. |
| Python | Your application or agent uses Python. | Install [`redis-iris`](https://pypi.org/project/redis-iris/) and follow the [quickstart](/content/develop/ai/context-engine/intent-router/quickstart.md). `IntentRouter` matches queries and authors intents, and its `service` property administers Routers. Its `client` property is the generated client, for a call the library doesn't wrap. |
| CLI | You work from a shell, a script, or continuous integration. | The `iris intent-router` commands ship in the same [`redis-iris`](https://pypi.org/project/redis-iris/) package. |
| HTTP | You need language-independent access or don't want a package dependency. | No package required. Send requests as shown in the [API reference](/content/develop/ai/context-engine/intent-router/api-reference.md). |

The `redis-iris` package requires Python 3.11 or later. The TypeScript client requires Node.js 22 or later. The TypeScript client is a generated client, not a unified software development kit (SDK) equivalent to Python's `redis-iris` package.
The `redis-iris` package requires Python 3.11 or later.

## Connect to a Router

Expand All @@ -41,28 +40,27 @@ Data-plane requests need:
* The Router's ID, which starts with `rtr_`.
* An agent key with a grant on the Router, sent as a bearer token on every request. Matching needs `read`, and authoring needs `write`.

Export them as `IRIS_INTENT_ROUTER_URL`, `IRIS_INTENT_ROUTER_ID`, and `IRIS_INTENT_ROUTER_API_KEY`. The CLI reads these variables, and in Python `IntentRouter.from_env()` builds a client from them. The TypeScript client doesn't read the environment, so the examples pass the same values to its constructor.
Export them as `IRIS_INTENT_ROUTER_URL`, `IRIS_INTENT_ROUTER_ID`, and `IRIS_INTENT_ROUTER_API_KEY`. The CLI reads these variables, and in Python `IntentRouter.from_env()` builds a client from them.

Administration requests go to the control plane and need its URL and the admin token, which your platform team holds. The Python package and the CLI read them from `IRIS_INTENT_ROUTER_SERVICE_URL` and `IRIS_INTENT_ROUTER_SERVICE_TOKEN`. See [Manage Routers](/content/develop/ai/context-engine/intent-router/manage-routers.md#before-you-begin).

Keep the admin token out of application configuration. An agent key can't create, change, or delete Routers.

## Work with intents

Create intents with `upsert`, add several at once with the bulk operation, and manage examples separately from an intent's configuration. See [Manage intents and examples](/content/develop/ai/context-engine/intent-router/manage-intents.md).
Create or replace an intent with `define` in Python or `intents put` in the CLI, add several at once with the bulk operation, and manage examples separately from an intent's configuration. See [Manage intents and examples](/content/develop/ai/context-engine/intent-router/manage-intents.md).

## Match queries

Send each query to `match` and read the best item's target. An empty list means no intent is close enough. See [Match queries](/content/develop/ai/context-engine/intent-router/match.md).
Send each query to `match` and read the best item's target. In Python, `match` returns the items best first, and `best` is the closest intent, or `None`. An empty list means no intent is close enough. See [Match queries](/content/develop/ai/context-engine/intent-router/match.md).

## Handle errors

Every client raises an error that carries the HTTP status and the problem `type`. Match on the `type`. A `409` from a Router that isn't serving, a `424` from the embedding provider, or a `503` is worth retrying with backoff. A `412` means the intent changed since you read it. A `401` means the key is invalid, and a `403` means it lacks the action the operation needs. See [service limits and errors](/content/develop/ai/context-engine/intent-router/limits.md#handle-request-errors).
A failed request returns an HTTP status and a problem `type`. Match on the `type`. A `409` from a Router that isn't serving, a `424` from the embedding provider, or a `503` is worth retrying with backoff. A `412` means the intent changed since you read it. A `401` means the key is missing, invalid, expired, or revoked. See [service limits and errors](/content/develop/ai/context-engine/intent-router/limits.md#handle-request-errors).

## References

* [Quickstart](/content/develop/ai/context-engine/intent-router/quickstart.md)
* [Python and CLI package reference](https://pypi.org/project/redis-iris/)
* [TypeScript client reference](https://www.npmjs.com/package/@redis-iris/intent-router)
* [Data-plane API reference](/content/develop/ai/context-engine/intent-router/api-reference.md)
* [Control-plane API reference](/content/operate/iris/intent-router/self-managed/control-plane-api-reference.md)
16 changes: 7 additions & 9 deletions content/develop/ai/context-engine/intent-router/limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,14 @@ The API reports failures as [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) p

| Status | Type | Meaning and recovery |
|:-------|:-----|:---------------------|
| `400` | `/errors/invalid-data` | A field is invalid, `limit` exceeds the cap, or `If-Match` and `expectedRevision` disagree. The `fields` list names each field and the rule it broke. Fix the request. |
| `400` | `/errors/invalid-cursor` | The `cursor` can't be read. Start again without a cursor. |
| `400` | `/errors/invalid-data` | A field is invalid, `limit` exceeds the cap, the `cursor` can't be read, or `If-Match` and `expectedRevision` disagree. The `fields` list names each field and the rule it broke. Fix the request, or start a list again without a cursor. |
| `401` | `/errors/authentication-failed` | The agent key is missing, invalid, expired, or revoked. |
| `403` | `/errors/insufficient-permissions` | The key has no grant on this Router, or lacks the action the operation needs, such as `write` for authoring. |
| `404` | `/errors/resource-not-found` | The Router, intent, or example doesn't exist, or the Router is being deleted. Deleting a missing intent succeeds instead, and so does deleting an example the intent doesn't hold. |
| `408` | `/errors/timeout` | The request timed out. Retry with backoff. |
| `409` | `/errors/router-not-serving` | The Router is provisioning, has failed, or the data plane hasn't applied its latest configuration yet. Retry after a short wait, and check the Router's state if it persists. |
| `409` | `/errors/intent-limit-exceeded` | The Router already holds the maximum number of intents. Delete an intent or ask your administrator to raise the limit. |
| `409` | `/errors/conflict` | The Router is provisioning, has failed, or the data plane hasn't applied its latest configuration yet: retry after a short wait, and check the Router's state if it persists. Or the Router already holds the maximum number of intents: delete an intent or ask your administrator to raise the limit. |
| `412` | `/errors/revision-conflict` | The intent changed since the revision you sent. Read the intent, reapply your change, and retry. |
| `423` | `/errors/router-suspended` | An administrator suspended the Router. Retrying doesn't help until it resumes. |
| `424` | `/errors/dependency-unavailable` | The embedding provider is unavailable. Retry with backoff. |
| `423` | `/errors/resource-suspended` | An administrator suspended the Router. Retrying doesn't help until it resumes. |
| `424` | `/errors/resource-unavailable` | The embedding provider is unavailable. Retry with backoff. |
| `424` | `/errors/database-out-of-memory` | The Router's database is out of memory. Ask your administrator to add memory. |
| `500` | `/errors/unexpected-error` | An unexpected internal error. Retry once, then contact support with the request details. |
| `503` | `/errors/service-unavailable` | The Router's search index is rebuilding, or its database isn't answering. Wait for the `Retry-After` interval, then retry. |
Expand All @@ -81,10 +78,11 @@ The API reports failures as [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) p
| `400` | `/errors/invalid-data` | A field is invalid, the `vectorSpace` or `databaseId` isn't one the deployment offers, the deployment requires a `databaseId`, the `Idempotency-Key` is malformed, the requested state isn't `READY` or `SUSPENDED`, or an update is empty. |
| `401` | `/errors/authentication-failed` | The admin token is missing or wrong. Agent keys are refused here. |
| `404` | `/errors/resource-not-found` | The Router doesn't exist. Deleting a Router that is already gone succeeds instead. |
| `408` | `/errors/timeout` | The request timed out. Retry with backoff. |
| `409` | `/errors/conflict` | The tenant has reached its Router limit, the Router isn't `READY` or `SUSPENDED` for an update, or a request with the same `Idempotency-Key` is still running. |
| `412` | `/errors/revision-conflict` | The Router changed since the revision you sent. Read it and retry. |
| `422` | `/errors/idempotency-key-reused` | The `Idempotency-Key` was already used with a different request body. Use a new key. |
| `503` | `/errors/service-unavailable` | The control plane's storage isn't answering. Retry with backoff. |
| `424` | `/errors/resource-unavailable` | A store the control plane depends on is unavailable or unhealthy. Retry with backoff. |
| `500` | `/errors/unexpected-error` | An unexpected internal error. Retry once, then contact support with the request details. |

## Retry uncertain operations

Expand Down
Loading