Skip to main content
ai-query is a Python SDK for building AI features at three levels:
  • direct model calls
  • stateful agents
  • live controllable runtimes
It is not one giant abstraction. It is a ladder.

The Ladder

Start at the top. Move down only when your app needs the extra control.

First Example

Learn In Order

Quickstart

Build from one model call to a stateful agent in a few minutes.

Concepts

Understand the three layers: core generation, agents, and live turns.

Navigating ai-query

Choose the right primitive for your app.

Generating Text

Learn the raw model call before adding state or servers.

Core Building Blocks

Streaming

Stream model output directly or through an agent.

Tools

Expose typed Python functions to models.

Tool Loops

Understand multi-step tool execution and stop conditions.

Providers

Configure OpenAI, Anthropic, Google, OpenRouter, and more.

Stateful Agents

Stateful Agents

Add identity, storage, message history, and state.

Conversations

Work with message history and multi-turn context.

Live Turns

Build CLIs, UIs, SSE streams, and steerable runtimes.

Agent Server

Route many users to persistent agents.

Reference And Recipes

API Reference

Look up classes, functions, types, transports, and providers.

Cookbook

Copy working patterns for RAG, tools, MCP, deployment, and workflows.