Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

[FIX] Update example.py to reflect breaking API changes (#2471)

Daniel Shin6ce006eced28
diff --git a/examples/docs/example.py b/examples/docs/example.py
index 08424e39b..a01993a40 100644
--- a/examples/docs/example.py
+++ b/examples/docs/example.py
@@ -77,8 +77,8 @@ agent_copy = client.agents.create(
model="openai/gpt-4o-mini",
embedding="openai/text-embedding-ada-002",
)
-block = client.agents.core_memory.retrieve_block(agent.id, "human")
-agent_copy = client.agents.core_memory.attach_block(agent_copy.id, block.id)
+block = client.agents.blocks.retrieve(agent.id, "human")
+agent_copy = client.agents.blocks.attach(agent_copy.id, block.id)
print(f"Created agent copy with shared memory named {agent_copy.name}")
@@ -95,7 +95,7 @@ response = client.agents.messages.create(
print(f"Sent message to agent {agent_copy.name}: {message_text}")
-block = client.agents.core_memory.retrieve_block(agent_copy.id, "human")
+block = client.agents.blocks.retrieve(agent_copy.id, "human")
print(f"New core memory for agent {agent_copy.name}: {block.value}")
message_text = "What's my name?"