Starter Kit - Ships with your template. You own it - modify freely.
Overview
Thequeries agent executes SQL queries across Hyperdrive-connected databases with built-in safety, performance, and transformation features.
Key Features:
- Support for named queries from catalog (coming soon)
- Inline SQL queries with parameter binding
- Named and positional parameters
- Column name transformation (camelCase/snake_case)
- Read-only mode for safety
- Configurable row limits and timeouts
- Query result caching
/agents/system/queries/queries.yaml
Quick Start
Inline SQL with Positional Parameters
Inline SQL with Named Parameters
Input Schema
The queries agent accepts two mutually exclusive modes for specifying queries:Option 1: Inline SQL (sql)
Option 2: Named Query (queryName)
Output Schema
Example Output
Configuration
Configure the queries agent behavior using theconfig block:
Configuration Examples
Read-only with row limit:Parameter Binding
Positional Parameters
Use? placeholders in your SQL and provide values as an array:
Named Parameters
Use:paramName placeholders in your SQL and provide values as an object:
Optional Parameters
UseOR :param IS NULL patterns for optional filtering:
Example Queries
The starter kit includes example SQL queries in/queries/examples/:
User Lookup (user-lookup.sql)
Find users by email or ID with optional filtering:
Product Search (product-search.sql)
Full-text search with filtering and pagination:
Analytics Summary (analytics-summary.sql)
Aggregate metrics for a date range:
Best Practices
1. Use Named Parameters for Readability
Good:2. Enable Read-Only Mode in Production
3. Set Row Limits
4. Cache Expensive Queries
5. Use Column Transformation Consistently
6. Handle Optional Filters Properly
7. Use Separate Databases for Different Workloads
8. Set Appropriate Timeouts
9. Validate Input Parameters
10. Monitor Query Performance
Use the metadata in the output to track performance:Related Resources
Data Operations
Learn about D1, Hyperdrive, and Vectorize operations
Starter Kit Overview
Explore other agents in the starter kit

