How bird-bench/bird-interact works
Purpose and variants
BIRD-INTERACT is an interactive text-to-SQL benchmark: agents resolve ambiguous requests through dialogue, execute CRUD-capable SQL against task databases, and are scored with executable test cases. The repository contains legacy/reference implementations for fixed conversational interaction, dynamic agentic interaction, SQLite mini variants, evaluation infrastructure, and a newer modular ADK implementation.
Primary entry points
• Recommended implementation: BIRD-Interact-ADK/orchestrator/runner.py, with service startup in BIRD-Interact-ADK/scripts/start_services.sh.
• Dynamic a-Interact batch runs: bird_interact_agent/batch_run_bird_interact/main.py; experiment driver: bird_interact_agent/experiments/eval_react_bird_interact.py.
• Fixed c-Interact pipeline: bird_interact_conv/pipeline/run_gpt.sh, orchestrating staged inference under bird_interact_conv/code/.
• Official scoring: evaluation/run/run_eval.sh and evaluation/src/eval_bird_interact.py.
ADK microservice architecture
The ADK implementation separates three replaceable Python services:
• System agent service hosts the Google ADK runtime, agent definition, callbacks, and SQL-facing tools: BIRD-Interact-ADK/system_agent/server.py, BIRD-Interact-ADK/system_agent/agent.py, BIRD-Interact-ADK/system_agent/tools.py.
• User-simulator service turns ambiguous task data and dialogue into simulated user responses, including SQL-aware parsing: BIRD-Interact-ADK/user_simulator/server.py, BIRD-Interact-ADK/user_simulator/prompts.py, BIRD-Interact-ADK/user_simulator/sql_parser.py.
• Database-environment service isolates database access behind its own server: BIRD-Interact-ADK/db_environment/server.py.
• The orchestration layer selects a-Interact versus c-Interact execution, runs tasks (including parallel work), and emits reports: BIRD-Interact-ADK/orchestrator/runner.py, BIRD-Interact-ADK/orchestrator/ainteract.py, BIRD-Interact-ADK/orchestrator/cinteract.py.
Interaction and SQL execution flow
A task supplies a selected database, ambiguous query, ambiguity annotations, contextual knowledge, lifecycle SQL, and hidden solution/test data. In a-Interact, the model decides when to ask the simulator, inspect/act on the database, and finalize SQL. In c-Interact, dialogue follows a predetermined multi-stage flow before SQL wrap-up. SQL parsing is a critical boundary between natural-language interactions and executable statements. Agent/environment abstractions implement this loop in bird_interact_agent/src/envs/ic_env.py, bird_interact_agent/src/envs/bird_interact_env/sql_env.py, and bird_interact_agent/src/envs/user_simulator/us_env_bird_interact.py.
Model-provider boundary
LLM calls are abstracted from interaction logic. The legacy agent supports provider/API implementations and CLI/human alternatives through bird_interact_agent/src/llm_utils/llm_provider.py, bird_interact_agent/src/llm_utils/llm_agent.py, and bird_interact_agent/src/llm_utils/api_util.py. The ADK version uses LiteLLM-compatible providers via BIRD-Interact-ADK/shared/llm.py, allowing agent models to be swapped without changing the orchestrator or services.
Evaluation and database infrastructure
Docker provisions PostgreSQL databases for Lite and Full datasets plus an evaluation container: env/docker-compose.yml, env/Dockerfile.postgresql, env/Dockerfile.bird_interact_eval. Evaluation applies preprocessing/cleanup and validates predicted SQL against executable test cases; PostgreSQL is primary, while adapters also support MySQL, MSSQL, and Oracle: evaluation/src/eval_bird_interact_batch.py, evaluation/src/postgresql_utils.py, evaluation/src/wrapper_evaluation_postgresql.py.
Related distributions
mini_interact/knowledge_based/ mirrors the benchmark architecture for SQLite-oriented Mini-Interact. usersim-guard/ is a separate user-simulator guard pipeline, including LLM-as-judge behavior: usersim-guard/run_pipeline.py, usersim-guard/user_simulator/pipeline.py, usersim-guard/user_simulator/llm_as_judge.py.
Main entry points: system_agent/server.py System agent service · user_simulator/server.py User simulator service · ic_env.py Agent/environment loop · db_environment/server.py Database environment service
Components 20
ADK implementation
Recommended modular runtime.
- Service startup · Starts the ADK service set.
BIRD-Interact-ADK/scripts/start_services.sh - Task runner · Selects interaction mode, parallelizes tasks, and writes reports.
BIRD-Interact-ADK/orchestrator/runner.py - a-Interact flow · Lets the model decide when to ask, inspect, act, and finalize.
BIRD-Interact-ADK/orchestrator/ainteract.py - c-Interact flow · Runs the predetermined dialogue stages before SQL wrap-up.
BIRD-Interact-ADK/orchestrator/cinteract.py - System agent service · Hosts ADK agent runtime, callbacks, and SQL tools.
BIRD-Interact-ADK/system_agent/server.py - User simulator service · Produces SQL-aware simulated user responses.
BIRD-Interact-ADK/user_simulator/server.py - Database environment service · Isolates task database access behind a server boundary.
BIRD-Interact-ADK/db_environment/server.py - LiteLLM provider layer · Makes ADK agent models replaceable.
BIRD-Interact-ADK/shared/llm.py
Legacy interaction
Reference dynamic and fixed pipelines.
- Dynamic batch runner
bird_interact_agent/batch_run_bird_interact/main.py - Dynamic experiment driver
bird_interact_agent/experiments/eval_react_bird_interact.py - Agent/environment loop · Coordinates agent actions, database state, and user simulation.
bird_interact_agent/src/envs/ic_env.py - SQL environment · Executes agent database actions.
bird_interact_agent/src/envs/bird_interact_env/sql_env.py - Legacy user simulator
bird_interact_agent/src/envs/user_simulator/us_env_bird_interact.py - Legacy LLM abstraction · Supports API providers plus CLI and human alternatives.
bird_interact_agent/src/llm_utils/llm_provider.py - Fixed c-Interact pipeline · Orchestrates fixed conversational inference stages.
bird_interact_conv/pipeline/run_gpt.sh
Evaluation infrastructure
Executable database-backed scoring.
- Official evaluation · Runs executable benchmark scoring.
evaluation/run/run_eval.sh - SQL validation engine · Preprocesses predictions and validates them with executable test cases.
evaluation/src/eval_bird_interact.py - Dataset PostgreSQL · Docker-provisioned Lite and Full task databases.
env/docker-compose.yml
Related distributions
- Mini-Interact · SQLite-oriented mirror of the benchmark architecture.
- User-simulator guard · Separate LLM-as-judge user-simulator guard pipeline.
usersim-guard/run_pipeline.py
Connections 23
- Service startup → System agent service: starts
- Service startup → User simulator service: starts
- Service startup → Database environment service: starts
- Task runner → a-Interact flow: selects
- Task runner → c-Interact flow: selects
- a-Interact flow → System agent service: runs agent
- a-Interact flow → User simulator service: asks questions
- c-Interact flow → System agent service: runs SQL wrap-up
- c-Interact flow → User simulator service: uses staged dialogue
- System agent service → Database environment service: SQL tools
- System agent service → LiteLLM provider layer: model calls
- User simulator service → Database environment service: SQL-aware parsing
- Dynamic batch runner → Agent/environment loop: runs tasks
- Dynamic experiment driver → Dynamic batch runner: drives
- Agent/environment loop → SQL environment: database actions
- Agent/environment loop → Legacy user simulator: dialogue turns
- Agent/environment loop → Legacy LLM abstraction: model calls
- Fixed c-Interact pipeline → SQL environment: staged inference SQL
- Official evaluation → SQL validation engine: invokes
- SQL validation engine → Dataset PostgreSQL: executes test cases
- SQL environment → Dataset PostgreSQL: task databases
- Database environment service → Dataset PostgreSQL: task databases
- User-simulator guard → User simulator service: related guard behavior