What the agent does
The agent reads how the models are declared and how the service runs, since the warning names a function and the fix is one import. In a small Twisted service like jekil/UDPot, a DNS honeypot, everything lives in dns.py: line 37 imports declarative_base from sqlalchemy.ext.declarative, line 40 calls it, and the one model Dns maps the dns table with id, transport, src, src_port, dns_name, dns_type, dns_cls and a created_at default. create_engine(opts.sql) runs at line 194, sessionmaker at 195 and Base.metadata.create_all(engine) at 199. requirements.txt pins SQLAlchemy==2.0.45 and Twisted==25.5.0, and the Dockerfile builds on python:3.12-slim and starts the script on port 5053 with a SQLite URL and a JSON log file.
Then it reproduces. With the pinned versions installed, python dns.py --help prints dns.py:40: MovedIn20Warning: The ``declarative_base()`` function is now available as sqlalchemy.orm.declarative_base(). (deprecated since: 2.0) (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9) before the usage text, so the warning fires at import time on every start, not only on a query. The agent also checks the newest release on PyPI, SQLAlchemy 2.1.8, in a separate environment: the old import path still exists there and prints the same warning, so pinning a newer release would not make it go away.
The fix is from sqlalchemy.orm import declarative_base, leaving Base = declarative_base() and the model untouched. With that line changed, --help prints the usage text and nothing else. The agent does not reach for the DeclarativeBase class style, because the model uses Column and the project's own install instructions name sqlalchemy with no major, and a one-import change is what the warning asks for.
Proof is the honeypot doing its job after the change. The agent starts it on an unprivileged port with a fresh SQLite file and the JSON log, sends one UDP query for an A record of example.com with a hand-built packet, gets a 61-byte reply, and reads one row back from the dns table (UDP, 127.0.0.1, example.com, A, a timestamp) plus the matching JSON line. The pull request carries that transcript rather than a statement that the import is equivalent.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Our service prints \"MovedIn20Warning: The declarative_base() function is now available as sqlalchemy.orm.declarative_base()\" on every start. Find every import from sqlalchemy.ext.declarative, say which SQLAlchemy version the requirements pin and whether the newest release still prints the warning, and change each import to its sqlalchemy.orm equivalent without changing the models. Start the service before and after to show the warning gone, exercise one real request against it with its SQLite database, and open a pull request with the output and the rows written.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
A pull request that changes one import line in dns.py and nothing else in the models. The description quotes the warning as printed with its file and line, names the pinned SQLAlchemy and Twisted versions, notes that 2.1.8 still emits it, and shows --help output before and after.
A reviewer checks that the model still maps the same table and columns, that create_all still runs on start, and that the end-to-end check wrote one row for one query. The Dockerfile and requirements.txt are unchanged, which the description states.
The description also records what the agent saw and left alone: datetime.now(timezone.utc) for created_at, the twisted.names server setup, and the bare python:3.12-slim image, none of which the warning concerns.
Run it on every Dependabot pull request that bumps SQLAlchemy
The warning tends to appear when a pin moves, so the trigger is the pull request that moves it. An automation with a github trigger on pull_request.opened and pull_request.synchronize runs this prompt on each one, with the event appended after the prompt, and pushes the import change onto the bump's branch when the service prints a MovedIn20Warning at start.
For several services that share the same model style, your server sends this request once per repository, each with its own UUID as request_id so a retry returns the run already started, and reads each run.completed webhook; a key starts at most max_concurrent runs at once and queues the rest.
The use case this job follows, with its automation and trigger: Fix a bug from an alert.
Why run it on Rush?
The warning is one line, but checking that the replacement is really equivalent means starting the service and sending it traffic, which nobody does for an import rename on a laptop. In a Rush sandbox the agent runs the honeypot, sends a packet, and reads the database back, so the pull request shows the row that proves the models still work.
The agent also answers the question behind the warning: whether a newer SQLAlchemy would remove the old path or silence it. It installs the newest release in a second environment and reports that the import still exists with the same warning, so the reviewer knows the code change is the fix and not a version pin.
Frequently asked questions
Will upgrading SQLAlchemy make the warning go away?
No. On the newest release on PyPI at the time of the run, 2.1.8, sqlalchemy.ext.declarative.declarative_base still exists and prints the same MovedIn20Warning. The import has to move to sqlalchemy.orm.
Do my models change?
Not for this fix. declarative_base() from sqlalchemy.orm returns the same kind of base, so Column definitions, __tablename__ and Base.metadata.create_all stay as they are. Moving to the DeclarativeBase class and Mapped annotations is a separate, larger change.
Why does the warning show at start and not on a query?
Because it fires when declarative_base() is called, which happens at import time where Base is defined. Any command that imports the module, including --help, prints it once.
How does the agent prove the service still works?
It starts the honeypot on an unprivileged port with a fresh SQLite file, sends one DNS query, and reads the resulting row and JSON log line back. The pull request includes that transcript.