> ## Documentation Index
> Fetch the complete documentation index at: https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Cookbook

> Practical recipes and examples for building with ai-query

The cookbook contains practical, copy-paste recipes for common use cases. Each recipe is a complete, working example you can adapt for your projects.

<Info>
  Looking for runnable code? Check out the [examples folder](https://github.com/Abdulmumin1/ai-query/tree/main/examples) on GitHub for complete, standalone scripts.
</Info>

## Core Patterns

<CardGroup cols={2}>
  <Card title="Stateless Generation" icon="function" href="/tutorials/stateless-generation">
    Use generate\_text and stream\_text directly for maximum flexibility
  </Card>

  <Card title="Multimodal Chatbot" icon="image" href="/tutorials/multimodal-chatbot">
    Handle images and files in conversations
  </Card>

  <Card title="Structured Output" icon="brackets-curly" href="/tutorials/structured-output">
    Get typed, structured JSON responses from AI models
  </Card>
</CardGroup>

## Agents & Servers

<CardGroup cols={2}>
  <Card title="Profile Research Agent" icon="user-secret" href="/how-to/profile-research-agent">
    OSINT agent with durable SSE streaming and event replay
  </Card>

  <Card title="Persistent Chatbot" icon="database" href="/tutorials/persistent-chatbot">
    AI chatbot that remembers conversations across sessions
  </Card>

  <Card title="Per-User Assistant" icon="users" href="/tutorials/per-user-assistant">
    Create isolated AI assistants for each user
  </Card>

  <Card title="FastAPI Integration" icon="bolt" href="/how-to/fastapi-integration">
    Custom HTTP endpoints and middleware
  </Card>

  <Card title="Serverless Agents" icon="cloud" href="/how-to/serverless-agents">
    Deploy to AWS Lambda, Vercel, and Cloud Run
  </Card>

  <Card title="Cloudflare Durable Objects" icon="bolt" href="/how-to/cloudflare-durable-objects">
    Run stateful agents at the edge with Python DOs
  </Card>
</CardGroup>

## Tools & Tasks

<CardGroup cols={2}>
  <Card title="Task Planner" icon="list-check" href="/how-to/task-planner">
    AI-powered task breakdown and planning
  </Card>

  <Card title="RAG Agent" icon="search" href="/how-to/rag-agent">
    Build a retrieval-augmented generation agent
  </Card>

  <Card title="Multi-Agent Workflow" icon="network-wired" href="/how-to/multi-agent-workflow">
    Coordinate multiple specialized agents
  </Card>

  <Card title="MCP Agent" icon="plug" href="/how-to/mcp-agent">
    Use tools from any MCP server
  </Card>

  <Card title="Code Executor" icon="code" href="/how-to/code-executor">
    Execute Python code safely in a sandbox
  </Card>

  <Card title="Wikipedia Agent" icon="wikipedia-w" href="/how-to/wikipedia-agent">
    Research agent that searches Wikipedia
  </Card>
</CardGroup>
