Skip to content

Commit

Permalink
fix: uncomment method since it's still referenced, but updated it to …
Browse files Browse the repository at this point in the history
…be the new code from the route
  • Loading branch information
cpacker committed Nov 30, 2024
1 parent cb79c62 commit a8f3a5c
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions letta/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,18 +949,22 @@ def update_agent(
# TODO: probably reload the agent somehow?
return letta_agent.agent_state

# def get_tools_from_agent(self, agent_id: str, user_id: Optional[str]) -> List[Tool]:
# """Get tools from an existing agent"""

# if self.user_manager.get_user_by_id(user_id=user_id) is None:
# raise ValueError(f"User user_id={user_id} does not exist")
# if self.ms.get_agent(agent_id=agent_id) is None:
# raise ValueError(f"Agent agent_id={agent_id} does not exist")
#

# # Get the agent object (loaded in memory)
# letta_agent = self.load_agent(agent_id=agent_id)
# return letta_agent.agent_state.tools
def get_tools_from_agent(self, agent_id: str, user_id: Optional[str]) -> List[Tool]:
"""Get tools from an existing agent"""
# TODO deprecate or remove duplicate code in FastAPI route

actor = self.get_user_or_default(user_id=user_id)

agent_state = self.get_agent(agent_id=agent_id)
if not agent_state:
raise HTTPException(status_code=404, detail=f"Agent agent_id={agent_id} not found.")
tool_names = agent_state.tool_names
tools = []
for tool_name in tool_names:
tool = self.tool_manager.get_tool_by_name(tool_name=tool_name, actor=actor)
tools.append(tool)

return tools

def add_tool_to_agent(
self,
Expand Down

0 comments on commit a8f3a5c

Please sign in to comment.