fix: Add agent_id property to BaseAgentV2 for backward compatibility (#8806)

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 <noreply@letta.com>
This commit is contained in:
github-actions[bot]
2026-01-30 12:30:39 -08:00
committed by Caren Thomas
parent 5cde3c2ec0
commit 9471fab2cf

View File

@@ -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,