Files
crewAI/lib
Greyson LaLonde ac0a4b2bd9 fix: make BaseTool survive checkpoint JSON round-trip
BaseTool could not serialize to JSON because args_schema (a class
reference) and cache_function (a lambda) are not JSON-serializable.
This caused checkpointing to crash for any crew with tools.

- Add PlainSerializer to args_schema so it round-trips via JSON schema
- Replace default cache_function lambda with named _default_cache_function
  and type it as SerializableCallable
- Add computed_field tool_type storing the fully qualified class name
- Add __init_subclass__ registry and __get_pydantic_core_schema__ on
  BaseTool so any list[BaseTool] field automatically dispatches to the
  concrete subclass during deserialization via tool_type lookup
- No changes needed to BaseAgent.validate_tools or Task — Pydantic
  handles it natively through the custom core schema
2026-04-07 02:27:21 +08:00
..