From 9471fab2cf9759969bf0637aae89d29e91b2899d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 12:30:39 -0800 Subject: [PATCH] fix: Add agent_id property to BaseAgentV2 for backward compatibility (#8806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The LettaAgentV3 (and LettaAgentV2) agents inherit from BaseAgentV2, which unlike the original BaseAgent class, did not expose an agent_id attribute. This caused AttributeError: 'LettaAgentV3' object has no attribute 'agent_id' when code attempted to access self.agent_id. This fix adds an agent_id property to BaseAgentV2 that returns self.agent_state.id, maintaining backward compatibility with code that expects the self.agent_id interface from the original BaseAgent. Closes #8805 🤖 Generated with [Letta Code](https://letta.com) Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com> Co-authored-by: Letta --- letta/agents/base_agent_v2.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/letta/agents/base_agent_v2.py b/letta/agents/base_agent_v2.py index df45b176..b6fe89ce 100644 --- a/letta/agents/base_agent_v2.py +++ b/letta/agents/base_agent_v2.py @@ -25,6 +25,11 @@ class BaseAgentV2(ABC): self.actor = actor self.logger = get_logger(agent_state.id) + @property + def agent_id(self) -> str: + """Return the agent ID for backward compatibility with code expecting self.agent_id.""" + return self.agent_state.id + @abstractmethod async def build_request( self,