Skip to content

The agent engineering platform.

Stringify `AgentType` before saving to yaml (#2998)

Harutaka Kawamuraba9cc230faf0
diff --git a/langchain/agents/agent.py b/langchain/agents/agent.py
index e7082f7bd3..c675b55828 100644
--- a/langchain/agents/agent.py
+++ b/langchain/agents/agent.py
@@ -117,7 +117,7 @@ class BaseSingleActionAgent(BaseModel):
def dict(self, **kwargs: Any) -> Dict:
"""Return dictionary representation of agent."""
_dict = super().dict()
- _dict["_type"] = self._agent_type
+ _dict["_type"] = str(self._agent_type)
return _dict
def save(self, file_path: Union[Path, str]) -> None:
@@ -229,7 +229,7 @@ class BaseMultiActionAgent(BaseModel):
def dict(self, **kwargs: Any) -> Dict:
"""Return dictionary representation of agent."""
_dict = super().dict()
- _dict["_type"] = self._agent_type
+ _dict["_type"] = str(self._agent_type)
return _dict
def save(self, file_path: Union[Path, str]) -> None: