mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
* Refactoring task cache to be a tool The previous implementation of the task caching system was early exiting the agent executor due to the fact it was returning an AgentFinish object. This now refactors it to use a cache specific tool that is dynamically added and forced into the agent in case of a task execution that was already executed with the same input.
15 lines
378 B
Python
15 lines
378 B
Python
from langchain_core.agents import AgentAction
|
|
from pydantic.v1 import BaseModel, Field
|
|
|
|
from .cache_handler import CacheHandler
|
|
|
|
|
|
class CacheHit(BaseModel):
|
|
"""Cache Hit Object."""
|
|
|
|
class Config:
|
|
arbitrary_types_allowed = True
|
|
|
|
action: AgentAction = Field(description="Action taken")
|
|
cache: CacheHandler = Field(description="Cache Handler for the tool")
|