# ai-query ## Docs - [Abort / Cancellation](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/abort.md): Cancel long-running operations with AbortController and AbortSignal - [Agent RPC & Actions](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/agent-rpc.md): Build robust, multi-user agents with a structured RPC system. - [Agent Server](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/agent-server.md): Run multiple independent agent instances on a single server with routing - [Tool Loops](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/agents.md): How ai-query runs multi-step model and tool workflows - [Conversations](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/conversations.md): Build multi-turn conversations with message history - [Embeddings](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/embeddings.md): Generate vector embeddings for semantic search and similarity - [Agent Events](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/events.md): Emit real-time updates with automatic replay and persistence - [Generating Text](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/generate-text.md): Generate text completions from AI models - [Hooks](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/hooks.md): Control step and tool execution without rewriting the runtime - [Live Turns](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/live-turns.md): Use AgentTurn for events, cancellation, and mid-run steering - [MCP Integration](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/mcp.md): Connect to MCP (Model Context Protocol) servers and use their tools seamlessly - [Navigating ai-query](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/navigating-ai-query.md): Which API to use first, and when to move deeper - [Concepts](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/overview.md): The mental model for ai-query - [Providers Overview](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/providers.md): Connect to AI models from any provider - [Stateful Agents](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/stateful-agents.md): Add identity, memory, storage, tools, and events to model calls - [Streaming](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/streaming.md): Stream AI responses in real-time - [Thinking](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/thinking.md): Control reasoning depth and receive provider thinking output safely - [Tools](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/tools.md): Define tools for AI function calling - [Transports & Registry](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/transports.md): Configure how agents communicate and where they run - [About the Unified Transport Layer](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/core/unified-transport-layer.md): Architecture and design of the multi-agent transport layer - [Advanced Transport Patterns](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/advanced-transport-patterns.md): Orchestration, load balancing, and custom transports for multi-agent systems - [Cloudflare Durable Objects](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/cloudflare-durable-objects.md): Run stateful Agents on Cloudflare Workers with Durable Objects - [Durable Objects](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/cloudflare-workers.md): Deploy stateful, persistent, and serverless agents using Cloudflare Durable Objects - [Code Executor](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/code-executor.md): AI agent that writes and executes Python code - [Deployment & Adapters](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/deployment.md): Deploy agents to serverless platforms using built-in adapters - [FastAPI Integration](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/fastapi-integration.md): Use ai-query with FastAPI for custom HTTP endpoints - [Cookbook](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/index.md): Practical recipes and examples for building with ai-query - [MCP Agent](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/mcp-agent.md): Build a chatbot that uses tools from an MCP server - [Multi-Agent Workflow](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/multi-agent-workflow.md): Coordinate multiple specialized agents to complete complex tasks - [Profile Research Agent](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/profile-research-agent.md): OSINT Intelligence Tool with Durable SSE Streaming - [Anthropic](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/anthropic.md): Use Claude models with ai-query - [Bedrock](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/bedrock.md): Use AWS Bedrock models with ai-query - [Custom Providers](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/custom-providers.md): Build your own ai-query provider adapters - [DeepSeek](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/deepseek.md): Use DeepSeek's advanced AI models - [Google](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/google.md): Use Gemini models with ai-query - [Groq](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/groq.md): Use Groq's ultra-fast inference for open models - [Meta Llama](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/llama.md): Use Meta Llama models via the official API - [OpenAI](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/openai.md): Use OpenAI models with ai-query - [OpenRouter](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/openrouter.md): Use any AI model through OpenRouter's unified API - [Workers AI](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/workers-ai.md): Use Cloudflare Workers AI models with ai-query - [xAI](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/providers/xai.md): Use xAI models (Grok) via the official API - [RAG Agent](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/rag-agent.md): Build a retrieval-augmented generation agent with embeddings and search tools - [Serverless Agents](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/serverless-agents.md): Deploy agents to AWS Lambda, Vercel, and other platforms - [Task Planner](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/task-planner.md): Multi-step task executor with stop conditions - [Wikipedia Agent](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/how-to/wikipedia-agent.md): Research agent that searches and summarizes Wikipedia - [ai-query](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/index.md): Python primitives for model calls, tools, and stateful agents - [Agent](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/agent.md): API reference for the Agent class - [Storage Backends](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/agent-backends.md): Built-in storage backends for agents - [AgentRegistry](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/agent-registry.md): API reference for multi-agent registry with local and remote routing - [AgentServer](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/agent-server.md): API reference for multi-agent server with unified transport layer routing - [AgentTurn](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/agent-turn.md): API reference for live agent turn execution - [embed](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/embed.md): Generate embeddings for text using embedding models - [generate_text](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/generate-text.md): API reference for non-streaming text generation - [HTTPTransport](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/http-transport.md): API reference for HTTP transport between agents - [MCP](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/mcp.md): MCP (Model Context Protocol) API reference - [anthropic()](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/providers/anthropic.md): Create an Anthropic Claude language model - [BaseProvider](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/providers/base-provider.md): Abstract base class for custom provider implementations - [bedrock()](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/providers/bedrock.md): Create an AWS Bedrock language model - [deepseek()](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/providers/deepseek.md): Create a DeepSeek language model - [google()](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/providers/google.md): Create a Google Gemini language model - [groq()](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/providers/groq.md): Create a Groq language model - [openai()](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/providers/openai.md): Create an OpenAI language model - [openrouter()](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/providers/openrouter.md): Create an OpenRouter language model - [workers_ai()](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/providers/workers-ai.md): Create a Cloudflare Workers AI model - [RemoteAgent & connect()](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/remote-agent.md): API reference for remote agent client proxy and connection function - [AWS Lambda Adapter](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/serverless-adapters/aws-lambda.md): API reference for the AWS Lambda handle_lambda adapter - [FastAPI Adapter](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/serverless-adapters/fastapi.md): API reference for the FastAPI AgentRouter adapter - [Vercel Adapter](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/serverless-adapters/vercel.md): API reference for the Vercel handle_vercel adapter - [stream_text](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/stream-text.md): API reference for streaming text generation - [Transport Base Classes](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/transport-base.md): API reference for AgentTransport and LocalTransport base classes - [Message](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/types/message.md): Represents a message in a conversation - [Result Types](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/types/results.md): API reference for generation, streaming, step, and turn result objects - [Stop Conditions](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/types/stop-conditions.md): Control when tool execution loops terminate - [Tool](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/types/tool.md): Define tools for AI function calling - [Usage](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/reference/types/usage.md): Token usage statistics - [Complete Multi-Agent Setup](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/tutorials/complete-multi-agent-setup.md): End-to-end example of setting up a multi-agent system with unified transport layer - [Multimodal Chatbot](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/tutorials/multimodal-chatbot.md): Handle images and files in conversations - [Per-User Assistant](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/tutorials/per-user-assistant.md): Create isolated AI assistants for each user with persistent state - [Persistent Chatbot](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/tutorials/persistent-chatbot.md): Build an AI chatbot that remembers conversations across sessions - [Quickstart](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/tutorials/quickstart.md): Build from a model call to a stateful agent - [Stateless Generation](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/tutorials/stateless-generation.md): Use ai-query's core functions directly for maximum flexibility - [Structured Output](https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/tutorials/structured-output.md): Get typed, structured JSON responses from AI models ## Optional - [GitHub](https://github.com/Abdulmumin1/ai-query) - [PyPI](https://pypi.org/project/ai-query/)