Skip to content

Agent installation phase separation#44

Open
clkao wants to merge 8 commits intodbt-labs:mainfrom
clkao:main
Open

Agent installation phase separation#44
clkao wants to merge 8 commits intodbt-labs:mainfrom
clkao:main

Conversation

@clkao
Copy link
Copy Markdown
Contributor

@clkao clkao commented Nov 5, 2025

Key Changes

  1. New Docker Infrastructure
  • Created docker/agents/Dockerfile - parameterized Dockerfile for all agents
  • Created shared/defaults/docker-compose-agent.yaml - parameterized compose file
  • Uses env vars: T_BENCH_DB_FLAVOR (e.g., "duckdb-dbt") and T_BENCH_AGENT_DIR (e.g., "claude_code")
  1. Moved Agent Installation to Build-Time
  • Removed agent installation from AbstractInstalledAgent.perform_task()
  • Agent is now pre-installed during Docker build
  • Only env var setup (API keys) happens at runtime

@clkao
Copy link
Copy Markdown
Contributor Author

clkao commented Nov 5, 2025

I've only tested claude, oracle, none agents.

@RobertIsmo
Copy link
Copy Markdown
Collaborator

Hey, I actually have some commits to completely remove runtime copying into container entirely, so I don't think these will be compatible. But I'll see what can be pulled from here!

@clkao
Copy link
Copy Markdown
Contributor Author

clkao commented Nov 6, 2025

@RobertIsmo is that in a PR? i want to get this and #39 in (plugins might need to copy setup script, such as dbt-mcp) so let me know if there's a new api.

clkao and others added 8 commits November 6, 2025 09:59
- Parameterized by BASE_IMAGE and AGENT_NAME build args
- Copies agent setup script from existing location
- Runs installation at build time instead of runtime
- Builds both base and agent images in single compose file
- Uses env vars for parameterization (DB_FLAVOR, AGENT_DIR)
- Agent service depends on base to ensure build order
Agent installation now happens at Docker build time, not runtime.
Only env var setup (API keys) happens at runtime.

- Remove: Copy install script to container
- Remove: Source install script execution
- Keep: Environment variable setup (needed for API keys)
- Keep: Agent execution logic

This eliminates 30-60s installation overhead per task.
- Accept agent_dir and agent_type parameters
- Auto-select docker-compose-agent.yaml for AbstractInstalledAgent
- Set T_BENCH_DB_FLAVOR and T_BENCH_AGENT_DIR env vars
- Extract db flavor from client_image_name

This enables building agent images with correct parameterization.
- Add agent_dir and agent_type parameters to Terminal.__init__
- Add same parameters to spin_up_terminal context manager
- Pass through to DockerComposeManager

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Create agent early in _run_trial to detect type
- Check if agent is AbstractInstalledAgent subclass
- Extract agent directory from module path
- Pass agent_dir and agent_type to spin_up_terminal
- Remove duplicate agent creation later in method

This enables automatic agent image selection for installed agents.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fix db_flavor extraction by passing it directly from the harness where
we have db_type and project_type, instead of trying to parse it from
the client_image_name which has a task-specific format.

Changes:
- Construct db_flavor as "{db_type}-{project_type}" in harness
- Add db_flavor parameter to spin_up_terminal, Terminal, and DockerComposeManager
- Use db_flavor directly in _get_agent_build_env_vars instead of parsing

This fixes the docker compose build error where it was looking for
Dockerfile.ade-bench__airbnb002__client instead of Dockerfile.duckdb-dbt

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add documentation about:
- Installed agents workflow (pre-installed in Docker images)
- Agent Docker images and parameterization
- Environment variable usage for docker-compose

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bstancil
Copy link
Copy Markdown
Collaborator

bstancil commented Nov 20, 2025

@clkao I added a couple comments on #39, but once that's in, do we want to use this or @RobertIsmo , do you have another approach that you'd prefer and we'd need to decide between?

@RobertIsmo
Copy link
Copy Markdown
Collaborator

@bstancil oh wow I thought I PRed this weeks ago, my bad. give me a sec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants