MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / attach_source

Method attach_source

methods/letta/client/client.py:1464–1478  ·  view source on GitHub ↗

Attach a source to an agent Args: agent_id (str): ID of the agent source_id (str): ID of the source source_name (str): Name of the source

(self, source_id: str, agent_id: str)

Source from the content-addressed store, hash-verified

1462 return Source(**response.json())
1463
1464 def attach_source(self, source_id: str, agent_id: str) -> AgentState:
1465 """
1466 Attach a source to an agent
1467
1468 Args:
1469 agent_id (str): ID of the agent
1470 source_id (str): ID of the source
1471 source_name (str): Name of the source
1472 """
1473 params = {"agent_id": agent_id}
1474 response = requests.patch(
1475 f"{self.base_url}/{self.api_prefix}/agents/{agent_id}/sources/attach/{source_id}", params=params, headers=self.headers
1476 )
1477 assert response.status_code == 200, f"Failed to attach source to agent: {response.text}"
1478 return AgentState(**response.json())
1479
1480 def detach_source(self, source_id: str, agent_id: str) -> AgentState:
1481 """Detach a source from an agent"""

Callers 1

attach_sourceMethod · 0.45

Calls 3

AgentStateClass · 0.90
patchMethod · 0.80
jsonMethod · 0.45

Tested by

no test coverage detected