Skip to content

Bound Agent Control database connection pool#236

Open
abhinav-galileo wants to merge 2 commits into
mainfrom
abhi/agent-control-db-pooling
Open

Bound Agent Control database connection pool#236
abhinav-galileo wants to merge 2 commits into
mainfrom
abhi/agent-control-db-pooling

Conversation

@abhinav-galileo

@abhinav-galileo abhinav-galileo commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add configurable SQLAlchemy async DB pool settings for the Agent Control server
  • apply pool_pre_ping, bounded pool size/overflow, pool timeout, and rollback-on-return for non-SQLite URLs
  • expose a Prometheus gauge for checked-out SQLAlchemy connections
  • dispose the async engine during FastAPI shutdown

Context

High-concurrency deployments can exhaust Postgres connections when connection budgets scale implicitly with server replicas. This makes Agent Control's DB connection budget explicit per server process instead of relying on SQLAlchemy defaults.

Defaults:

  • AGENT_CONTROL_DB_POOL_SIZE=5
  • AGENT_CONTROL_DB_MAX_OVERFLOW=0
  • AGENT_CONTROL_DB_POOL_TIMEOUT_SECONDS=5.0

Verification

  • uv run --package agent-control-server ruff check --config pyproject.toml server/src server/tests/test_config.py server/tests/test_db.py
  • uv run --package agent-control-server mypy --config-file pyproject.toml server/src
  • direct Python assertion check for Postgres/SQLite DB engine kwargs

make server-test could not complete locally because Docker is unavailable and the shared test fixture requires Postgres on localhost:5432.

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@abhinav-galileo abhinav-galileo force-pushed the abhi/agent-control-db-pooling branch from 54d842f to ed28d63 Compare June 8, 2026 12:49
@abhinav-galileo abhinav-galileo marked this pull request as ready for review June 8, 2026 12:50
@abhinav-galileo abhinav-galileo marked this pull request as draft June 8, 2026 12:50
@abhinav-galileo abhinav-galileo marked this pull request as ready for review June 8, 2026 12:53
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.

1 participant