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.

feat: add mcp sdk example and upgrade letta-client version (#1262)

Sarah Wooderse642f365035d
diff --git a/examples/mcp_example.py b/examples/mcp_example.py
new file mode 100644
index 000000000..e27621a33
--- /dev/null
+++ b/examples/mcp_example.py
@@ -0,0 +1,43 @@
+from letta_client import Letta
+from pprint import pprint
+
+client = Letta(base_url="http://localhost:8283")
+
+mcp_server_name = "everything"
+mcp_tool_name = "echo"
+
+mcp_tools = client.tools.list_mcp_tools_by_server(
+ mcp_server_name=mcp_server_name,
+)
+for tool in mcp_tools:
+ pprint(tool)
+
+mcp_tool = client.tools.add_mcp_tool(
+ mcp_server_name=mcp_server_name,
+ mcp_tool_name=mcp_tool_name
+)
+
+agent = client.agents.create(
+ memory_blocks=[
+ {
+ "value": "Name: Caren",
+ "label": "human"
+ }
+ ],
+ model="openai/gpt-4o-mini",
+ embedding="openai/text-embedding-ada-002",
+ tool_ids=[mcp_tool.id]
+)
+print(f"Created agent id {agent.id}")
+
+response = client.agents.messages.create(
+ agent_id=agent.id,
+ messages=[
+ {
+ "role": "user",
+ "content": "Hello can you echo back this input?"
+ },
+ ],
+)
+for message in response.messages:
+ print(message)
diff --git a/poetry.lock b/poetry.lock
index ceae08b92..353f6a802 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
+# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
[[package]]
name = "aiohappyeyeballs"
@@ -2822,13 +2822,13 @@ pytest = ["pytest (>=7.0.0)", "rich (>=13.9.4,<14.0.0)"]
[[package]]
name = "letta-client"
-version = "0.1.62"
+version = "0.1.65"
description = ""
optional = false
python-versions = "<4.0,>=3.8"
files = [
- {file = "letta_client-0.1.62-py3-none-any.whl", hash = "sha256:8a4729a2ae2b613140ad6421bce98d381fed3c4f4c3327eff0a2844cb269747d"},
- {file = "letta_client-0.1.62.tar.gz", hash = "sha256:7e0b5090e688c4de8e9d39c09a68ce987b1a3fa0bfe2feee21252e190f7c3f44"},
+ {file = "letta_client-0.1.65-py3-none-any.whl", hash = "sha256:e7853d3742991e61b74d540ce7ad237528d860f1d63d1fd7a1bf5d237844d2ee"},
+ {file = "letta_client-0.1.65.tar.gz", hash = "sha256:5f83492bd84f68a3d9f816b5f840882d2cf39af5bb5aa2386079efec2fef51bd"},
]
[package.dependencies]
@@ -3664,13 +3664,13 @@ files = [
[[package]]
name = "openai"
-version = "1.66.2"
+version = "1.66.3"
description = "The official Python library for the openai API"
optional = false
python-versions = ">=3.8"
files = [
- {file = "openai-1.66.2-py3-none-any.whl", hash = "sha256:75194057ee6bb8b732526387b6041327a05656d976fc21c064e21c8ac6b07999"},
- {file = "openai-1.66.2.tar.gz", hash = "sha256:9b3a843c25f81ee09b6469d483d9fba779d5c6ea41861180772f043481b0598d"},
+ {file = "openai-1.66.3-py3-none-any.whl", hash = "sha256:a427c920f727711877ab17c11b95f1230b27767ba7a01e5b66102945141ceca9"},
+ {file = "openai-1.66.3.tar.gz", hash = "sha256:8dde3aebe2d081258d4159c4cb27bdc13b5bb3f7ea2201d9bd940b9a89faf0c9"},
]
[package.dependencies]
@@ -4504,6 +4504,7 @@ files = [
{file = "psycopg2-2.9.10-cp311-cp311-win_amd64.whl", hash = "sha256:0435034157049f6846e95103bd8f5a668788dd913a7c30162ca9503fdf542cb4"},
{file = "psycopg2-2.9.10-cp312-cp312-win32.whl", hash = "sha256:65a63d7ab0e067e2cdb3cf266de39663203d38d6a8ed97f5ca0cb315c73fe067"},
{file = "psycopg2-2.9.10-cp312-cp312-win_amd64.whl", hash = "sha256:4a579d6243da40a7b3182e0430493dbd55950c493d8c68f4eec0b302f6bbf20e"},
+ {file = "psycopg2-2.9.10-cp313-cp313-win_amd64.whl", hash = "sha256:91fd603a2155da8d0cfcdbf8ab24a2d54bca72795b90d2a3ed2b6da8d979dee2"},
{file = "psycopg2-2.9.10-cp39-cp39-win32.whl", hash = "sha256:9d5b3b94b79a844a986d029eee38998232451119ad653aea42bb9220a8c5066b"},
{file = "psycopg2-2.9.10-cp39-cp39-win_amd64.whl", hash = "sha256:88138c8dedcbfa96408023ea2b0c369eda40fe5d75002c0964c78f46f11fa442"},
{file = "psycopg2-2.9.10.tar.gz", hash = "sha256:12ec0b40b0273f95296233e8750441339298e6a572f7039da5b260e3c8b60e11"},
@@ -4563,6 +4564,7 @@ files = [
{file = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:bb89f0a835bcfc1d42ccd5f41f04870c1b936d8507c6df12b7737febc40f0909"},
{file = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:f0c2d907a1e102526dd2986df638343388b94c33860ff3bbe1384130828714b1"},
{file = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f8157bed2f51db683f31306aa497311b560f2265998122abe1dce6428bd86567"},
+ {file = "psycopg2_binary-2.9.10-cp313-cp313-win_amd64.whl", hash = "sha256:27422aa5f11fbcd9b18da48373eb67081243662f9b46e6fd07c3eb46e4535142"},
{file = "psycopg2_binary-2.9.10-cp38-cp38-macosx_12_0_x86_64.whl", hash = "sha256:eb09aa7f9cecb45027683bb55aebaaf45a0df8bf6de68801a6afdc7947bb09d4"},
{file = "psycopg2_binary-2.9.10-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b73d6d7f0ccdad7bc43e6d34273f70d587ef62f824d7261c4ae9b8b1b6af90e8"},
{file = "psycopg2_binary-2.9.10-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ce5ab4bf46a211a8e924d307c1b1fcda82368586a19d0a24f8ae166f5c784864"},
@@ -7045,4 +7047,4 @@ tests = ["wikipedia"]
[metadata]
lock-version = "2.0"
python-versions = "<3.14,>=3.10"
-content-hash = "2c10d39381e42fefcd0e9e5a31faa506a667973da96ebd0b53ebef02efbebdea"
+content-hash = "0c1b4dfec2397a4a8dc1c3c76c5b7a1a3691c778333d8379dae7722d28ae9ced"
diff --git a/pyproject.toml b/pyproject.toml
index 167c5a8e0..58abef8af 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -76,7 +76,7 @@ llama-index = "^0.12.2"
llama-index-embeddings-openai = "^0.3.1"
e2b-code-interpreter = {version = "^1.0.3", optional = true}
anthropic = "^0.43.0"
-letta_client = "^0.1.54"
+letta_client = "^0.1.65"
openai = "^1.60.0"
opentelemetry-api = "1.30.0"
opentelemetry-sdk = "1.30.0"