Training cutoff and API drift
Explain that a model's library knowledge is frozen at training time and blended across versions. It therefore defaults to whatever was most common in its training data, not to the version in your lockfile. Predict when this will bite (fast-moving libraries, recent major versions) and how to counter it: state the versions, and point the agent at the installed docs, type definitions or the lockfile.
Builds on: Why agents fill gaps with plausible guesses
Green tests, API from another version
Your `poetry.lock` pins Pydantic 2.7. You ask the agent to reject non-positive order quantities. It adds a validator, runs the tests, and they come back green. It never opened the lockfile. The code uses `@validator`, the Pydantic 1 decorator, and the test log shows a deprecation warning that nobody reads. Why did it reach for an API from the previous major version?
Its library knowledge is frozen and blended
The model learned libraries from public code up to its training cutoff. All versions are mixed together, weighted by how much code used each one. A major version released shortly before the cutoff has little public code yet, and the old one has years of it. Anything released after the cutoff is unknown. The most typical continuation is therefore often the old API, unless your version is in its context.
When it bites, and how to counter it
**High risk:** a major version released near or after the cutoff; fast-moving ecosystems (frontend frameworks, pre-1.0 Rust crates); renames where the old name still runs but is deprecated.
**Tells:** deprecation warnings, old import paths, two API styles in one file, the agent pinning an older version to make the build pass.
**Counter:** state the versions in the task or instruction file. Point the agent at the lockfile and at the installed docs, type definitions or source.
A v1 decorator in a v2 project
The tell is the import: `validator` is the Pydantic 1 API. In 2.x it still runs and only emits a `PydanticDeprecatedSince20` warning, so the tests go green even though the code targets the wrong version. **Later cost:** the code breaks when Pydantic removes the v1 names, and readers now see two validation styles in one codebase. The trustworthy version, written after the agent has read the installed Pydantic: `@field_validator("qty")` stacked on `@classmethod`.
// Python
--- a/app/schemas.py
+++ b/app/schemas.py
-from pydantic import BaseModel
+from pydantic import BaseModel, validator
class Order(BaseModel):
qty: int
+
+ @validator("qty")
+ def positive(cls, v):
+ if v <= 0:
+ raise ValueError("qty must be > 0")
+ return v
Steering it to the installed version
`pom.xml` uses Spring Boot 3 (Spring Security 6). The agent writes a class that `extends WebSecurityConfigurerAdapter`, which Security 6 removed. The build goes red. The agent's next idea is to pin an older Spring Security. Instead you reply: "We're on Boot 3.2. Read the installed `HttpSecurity` class first." It comes back with a `SecurityFilterChain` bean, the Security 6 style. Still check for blends: watch for that new bean calling `antMatchers`, which Security 6 also removed in favour of `requestMatchers`.
Remember
The agent writes the version its training data favoured, not the one in your lockfile. Expect this with recent major versions and fast-moving libraries. Counter it by stating versions and pointing the agent at the lockfile and the installed docs or types.
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.