Logo von Query

Query

OrganisationBeliebt
GetStream
query

How list endpoints take filters and sorts, modelled on Stream's query syntax. Read before adding a filter, a sort, or a query endpoint.

Übersicht

HerausgeberGetStream
RepositoryAgents
Skill-Namequery
Sterne
8.2K
Forks
709
Mitgelieferte Dateien
Nur Anweisungen
LizenzApache-2.0
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • In sich abgeschlossen

    Alles, was das Modell braucht, steht in den Anweisungen — keine zusätzlichen Dateien zum Synchronisieren.

  • Open Source

    Von GetStream auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Query in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/GetStream/Agents/tree/main/.claude/skills/query
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/GetStream/Agents.git /tmp/Agents
mkdir -p .claude/skills
cp -r /tmp/Agents/.claude/skills/query .claude/skills/query
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Query in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Query automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Query nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

Query

One filter language for every list, the one getstream.io uses for users, channels, messages and calls. A caller who has written one Stream query can write ours.

Paging is the pagination skill (.claude/skills/pagination/SKILL.md). Read it first: this skill decides which rows, that one decides where the page starts.

Shape

A resource that needs more than a couple of equality filters gets POST /v1/<resource>/query, operationId query<Resources>:

json
{
  "filter": {"state": "closed", "created_at": {"$gte": "2026-09-01T00:00:00Z"}},
  "sort": [{"field": "created_at", "direction": -1}],
  "limit": 25,
  "cursor": "…"
}

The answer is a page, {items, has_more, next_cursor}, as in pagination.

  • POST because a filter is a tree, and a tree in a query string is unreadable. It still reads and nothing changes.
  • A simple GET list with a couple of query parameters stays as it is. Add query<Resources> beside it when it outgrows them; don't add a tenth query parameter.
  • filter is optional. An empty filter is every row the caller may see.

Stream calls the field filter_conditions. We call it filter; the grammar is the same.

Filter grammar

A filter is a JSON object. Keys are field names or logical operators, and all keys at one level are ANDed.

OperatorMeaningExample
$eqequal; a bare value is shorthand{"state": "closed"}
$inequal to any of a list{"agent": {"$in": ["a", "b"]}}
$gt $gte $lt $lterange, on numbers and RFC3339 times{"created_at": {"$lt": "…"}}
$existsthe field is set or not{"ended_at": {"$exists": false}}
$containsarray holds the value; object holds every key and value{"custom": {"$contains": {"team": "x"}}}
$autocompleteprefix match on a name{"title": {"$autocomplete": "sup"}}
$qfull-text match{"title": {"$q": "billing refund"}}
$and $ora list of filters{"$or": [{"state": "running"}, {"agent": "x"}]}

custom.<key> is shorthand for $contains on the custom object: {"custom.team": "x"} is {"custom": {"$contains": {"team": "x"}}}.

Not supported, and a 400: $ne, $nin, $nor, $not, regexes. Negative filters walk every row that does not match instead of seeking to the ones that do. Rewrite them as a positive $in. Stream allows $ne only on id and booleans; we allow $ne only on booleans, where it is just $eq with the other value.

Rules

  • Each endpoint declares an allow-list: field → operators, and the column each field reads. Anything else is a 400 that names the field and the operator. Never pass a caller's field name into SQL; it is looked up in the allow-list and the column comes from there.
  • Only allow what an index serves. If (customer_id, agent, created_at, id) exists, agent gets $eq and $in; a field with no index gets nothing until it has one. Custom fields get $eq/$contains only, as containment (@>), which a jsonb_path_ops GIN index on the JSONB column answers. Never $exists on a custom key: key-exists (?, ?|, ?&) needs the default jsonb_ops index, which is several times larger.
  • $and/$or nest one level deep at most, and $in takes at most 100 values. Deeper trees are a 400; they are how a list becomes a table scan.
  • Scope is not a filter. The handler ANDs the customer, and for end users the user, onto whatever arrived, as SessionFilter.UserID does. A caller cannot widen it by writing $or.
  • Values are typed by the field: a time must parse as RFC3339, a number as a number, an enum as one of its values. A wrong type is a 400, not an empty page.

Sort

sort is a list of {"field", "direction"}, direction 1 ascending or -1 descending, as Stream does it. Fields come from a sort allow-list, usually two or three indexed columns.

  • Omitted, the endpoint's default applies, e.g. created_at descending.
  • The server appends id in the direction of the last key, so the order is total.
  • The cursor holds every sort key and a fingerprint of the sort. A cursor sent with a different sort is a 400. See pagination for why the keys are in the cursor.
  • One index per allowed sort, behind the filters it is used with.

Paging

As in pagination: limit + cursor, never offset. Stream Chat's queries page by offset with a 1,000 row ceiling; Stream Video's queryCalls hands back a next pointer. We do what Video does.

  • filter and sort are resent with every page. The cursor is only a position.
  • The next page is the filter ANDed with (sort keys, id) < (cursor values), flipped to > for ascending keys.
  • Fetch limit + 1 for has_more. No counts.

Go

Put the grammar in one package and reuse it; an endpoint only supplies its allow-lists.

  • A short allow-list needs no parser. querySessions (internal/api/session_query.go) declares its filter as closed Huma structs, with one struct per operator (Equals, TextMatch), so the schema validates the request and documents it too. Combinations the schema cannot express, such as a text search with project_id, are refused in sessionQueryOf. The cursor carries the sort, so a cursor from one sort is refused by another. Start here, and move to a tree only when $and, $or or $in are needed.
  • Parse the body into a tree once, validating against the allow-list as you go. The handler gets a typed tree or an invalidRequest APIError.
  • Compile the tree to bun Where clauses with bound values. Field names never reach SQL as text.
  • Where a list merges rows held in memory with rows in Postgres, like live sessions in Manager.find, the same tree needs a Match(item) too, so both halves filter and sort alike.
  • Document the allowed fields, operators and sorts in the operation's description; that is what a caller reads.
  • Tests follow the go-testing skill: one per allowed operator, one for a rejected field and a rejected operator, one for a nested $or, and one that pages a filtered, sorted list to the end without repeating or skipping a row.

SDKs

Go first, as AGENTS.md says. The filter is a plain map in every SDK (map[string]any, a dict, an object), which is how Stream's SDKs take filter_conditions. Sort is a typed list. List methods follow the cursor the way Items.Unwind does.

Häufig gestellte Fragen

Was macht der KI-Skill Query?

How list endpoints take filters and sorts, modelled on Stream's query syntax. Read before adding a filter, a sort, or a query endpoint.

Warum Query in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Query besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Query in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/GetStream/Agents/tree/main/.claude/skills/query ein. TypingMind liest die Datei SKILL.md und installiert den Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Query nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Query verwenden?

So viele Sie möchten. In TypingMind können Sie Query mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Query kostenlos?

Ja. Der Skill wird von GetStream auf GitHub unter der Lizenz Apache-2.0 veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇