﻿# CrewAI moves memoized project objects into their owning instance

Verify same-instance reuse, cross-instance separation and object collection when upgrading CrewAI; a cached agent must retain the configuration of its owning project.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-agent-crewai-memoized-instance-identity/
Language: en

CrewAI 1.15.38, published on November 8 at 19:39:30 UTC, fixes memoized project methods returning objects from a different instance. The packaged change moves cache ownership onto the instance while retaining repeated-call reuse within it. Long-lived processes constructing many crews should check identity and object lifetime separately from the quality of one successful run.

## Configuration needs an owning object

Construct two synthetic project instances with same-named factory methods but distinctive roles and harmless tool markers. Call each factory and assert that returned objects belong to the intended configuration. This targets cache identity rather than model response variability. A service can appear correct for its first crew while a later crew inherits stale state, so reverse construction order and repeat the fixture in the same process.

## Repeated calls should still reuse their result

Within one instance, call the decorated method repeatedly and compare object identity as well as contents. The fix isolates caches; it does not require rebuilding an agent for every call. Include synchronous and asynchronous methods the application uses. An acceptance test that only demands distinct objects everywhere would contradict useful memoization and could conceal a regression that increases setup work or loses intentionally shared state inside one crew.

## Object lifetime matters in persistent workers

Create and release many harmless crews while tracking whether old instances remain collectible. Keep external registries and application caches out of the first fixture so retention can be attributed. Then repeat with the real service wrapper. The release’s cache move addresses one ownership problem, not every source of memory growth. A stable resident-memory line alone cannot prove old objects disappeared if the allocator retains freed capacity.

## Keep the documented limits visible

The implementation leaves other argument-keying behavior and some unusual class layouts outside the change. Exercise custom decorators or wrappers separately rather than assuming all memoization now has value-based keys. Report instance configuration, method type and observed lifetime with the package revision. A useful adoption result proves local reuse without cross-project identity leakage and explains any retention still introduced by the application itself.

## Sources

- [CrewAI 1.15.38 release notes](https://github.com/crewAIInc/crewAI/releases/tag/1.15.38)
- [CrewAI implementation and review #9226](https://github.com/crewAIInc/crewAI/pull/9226)

## Related reading

- [Flyte 2 traces: a successful helper checkpoint is different from a failed external attempt](/journal/fg2-flyte-two-trace-success-checkpoint-replay-boundary/)
- [Retrying generation POSTs: idempotency must be explicit](/journal/provider-post-retry-idempotency-ledger/)
