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.

chore: Merge OSS (#562)

Matthew Zhou38b8fdd2dd77
diff --git a/.github/workflows/letta-web-safety.yml b/.github/workflows/letta-web-safety.yml
deleted file mode 100644
index 51dcbdbe1..000000000
--- a/.github/workflows/letta-web-safety.yml
+++ /dev/null
@@ -1,85 +0,0 @@
-name: "Letta Web Compatibility Checker"
-
-
-on:
- push:
- branches: [ main ]
- pull_request:
- branches: [ main ]
-
-
-jobs:
- cypress-run:
- runs-on: ubuntu-latest
- environment: Deployment
- # Runs tests in parallel with matrix strategy https://docs.cypress.io/guides/guides/parallelization
- # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
- # Also see warning here https://github.com/cypress-io/github-action#parallel
- strategy:
- fail-fast: false # https://github.com/cypress-io/github-action/issues/48
- matrix:
- containers: [ 1 ]
- services:
- redis:
- image: redis
- ports:
- - 6379:6379
- options: >-
- --health-cmd "redis-cli ping"
- --health-interval 10s
- --health-timeout 5s
- --health-retries 5
- postgres:
- image: postgres
- ports:
- - 5433:5432
- env:
- POSTGRES_DB: postgres
- POSTGRES_PASSWORD: postgres
- POSTGRES_USER: postgres
- options: >-
- --health-cmd pg_isready
- --health-interval 10s
- --health-timeout 5s
- --health-retries 5
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Checkout letta web
- uses: actions/checkout@v4
- with:
- repository: letta-ai/letta-web
- token: ${{ secrets.PULLER_TOKEN }}
- path: letta-web
- - name: Turn on Letta agents
- env:
- LETTA_PG_DB: letta
- LETTA_PG_USER: letta
- LETTA_PG_PASSWORD: letta
- LETTA_PG_PORT: 8888
- OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- run: docker compose -f dev-compose.yaml up --build -d
- - name: Cypress run
- uses: cypress-io/github-action@v6
- with:
- working-directory: letta-web
- build: npm run build:e2e
- start: npm run start:e2e
- project: apps/letta
- wait-on: 'http://localhost:3000' # Waits for above
- record: false
- parallel: false
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- CYPRESS_PROJECT_KEY: 38nemh
- DATABASE_URL: postgres://postgres:postgres@localhost:5433/postgres
- REDIS_HOST: localhost
- REDIS_PORT: 6379
- CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
- CYPRESS_GOOGLE_CLIENT_ID: ${{ secrets.CYPRESS_GOOGLE_CLIENT_ID }}
- CYPRESS_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_GOOGLE_CLIENT_SECRET }}
- CYPRESS_GOOGLE_REFRESH_TOKEN: ${{ secrets.CYPRESS_GOOGLE_REFRESH_TOKEN }}
- LETTA_AGENTS_ENDPOINT: http://localhost:8283
- NEXT_PUBLIC_CURRENT_HOST: http://localhost:3000
- IS_CYPRESS_RUN: yes
- OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
diff --git a/.github/workflows/notify-letta-cloud.yml b/.github/workflows/notify-letta-cloud.yml
new file mode 100644
index 000000000..0874be590
--- /dev/null
+++ b/.github/workflows/notify-letta-cloud.yml
@@ -0,0 +1,19 @@
+name: Notify Letta Cloud
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ notify:
+ runs-on: ubuntu-latest
+ if: ${{ !contains(github.event.head_commit.message, '[sync-skip]') }}
+ steps:
+ - name: Trigger repository_dispatch
+ run: |
+ curl -X POST \
+ -H "Authorization: token ${{ secrets.SYNC_PAT }}" \
+ -H "Accept: application/vnd.github.v3+json" \
+ https://api.github.com/repos/letta-ai/letta-cloud/dispatches \
+ -d '{"event_type":"oss-update"}'
diff --git a/letta/__init__.py b/letta/__init__.py
index 388f3a668..af21504af 100644
--- a/letta/__init__.py
+++ b/letta/__init__.py
@@ -1,4 +1,4 @@
-__version__ = "0.6.7"
+__version__ = "0.6.8"
# import clients
from letta.client.client import LocalClient, RESTClient, create_client
diff --git a/letta/services/tool_execution_sandbox.py b/letta/services/tool_execution_sandbox.py
index dc1fcea3f..e07c4ea2d 100644
--- a/letta/services/tool_execution_sandbox.py
+++ b/letta/services/tool_execution_sandbox.py
@@ -310,7 +310,6 @@ class ToolExecutionSandbox:
# Finally, get any that are passed explicitly into the `run` function call
if additional_env_vars:
env_vars.update(additional_env_vars)
-
code = self.generate_execution_script(agent_state=agent_state)
execution = sbx.run_code(code, envs=env_vars)
diff --git a/pyproject.toml b/pyproject.toml
index 8d709b597..1bcc282f9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "letta"
-version = "0.6.7"
+version = "0.6.8"
packages = [
{include = "letta"},
]
diff --git a/tests/integration_test_offline_memory_agent.py b/tests/integration_test_offline_memory_agent.py
index 15d4161d5..b6ccbf63d 100644
--- a/tests/integration_test_offline_memory_agent.py
+++ b/tests/integration_test_offline_memory_agent.py
@@ -1,7 +1,7 @@
import pytest
from letta import BasicBlockMemory
-from letta.client.client import Block, create_client
+from letta.client.client import create_client
from letta.constants import DEFAULT_HUMAN, DEFAULT_PERSONA
from letta.offline_memory_agent import (
finish_rethinking_memory,
@@ -37,14 +37,14 @@ def test_ripple_edit(client, mock_e2b_api_key_none):
trigger_rethink_memory_tool = client.create_or_update_tool(trigger_rethink_memory)
send_message = client.server.tool_manager.get_tool_by_name(tool_name="send_message", actor=client.user)
- conversation_human_block = Block(name="human", label="human", value=get_human_text(DEFAULT_HUMAN), limit=2000)
- conversation_persona_block = Block(name="persona", label="persona", value=get_persona_text(DEFAULT_PERSONA), limit=2000)
- offline_human_block = Block(name="human", label="human", value=get_human_text(DEFAULT_HUMAN), limit=2000)
- offline_persona_block = Block(name="persona", label="persona", value=get_persona_text("offline_memory_persona"), limit=2000)
+ conversation_human_block = client.create_block(label="human", value=get_human_text(DEFAULT_HUMAN), limit=2000)
+ conversation_persona_block = client.create_block(label="persona", value=get_persona_text(DEFAULT_PERSONA), limit=2000)
+ offline_human_block = client.create_block(label="human", value=get_human_text(DEFAULT_HUMAN), limit=2000)
+ offline_persona_block = client.create_block(label="persona", value=get_persona_text("offline_memory_persona"), limit=2000)
# Figure 1. from Evaluating the Ripple Effects of Knowledge Editing in Language Models (Cohen et al., 2023)
# https://arxiv.org/pdf/2307.12976
- fact_block = Block(
+ fact_block = client.create_block(
name="fact_block",
label="fact_block",
value="""Messi resides in the Paris.
@@ -55,8 +55,27 @@ def test_ripple_edit(client, mock_e2b_api_key_none):
Victor Ulloa plays for Inter Miami""",
limit=2000,
)
-
- new_memory = Block(name="rethink_memory_block", label="rethink_memory_block", value="[empty]", limit=2000)
+ new_memory = client.create_block(name="rethink_memory_block", label="rethink_memory_block", value="[empty]", limit=2000)
+
+ # conversation_human_block = Block(name="human", label="human", value=get_human_text(DEFAULT_HUMAN), limit=2000)
+ # conversation_persona_block = Block(name="persona", label="persona", value=get_persona_text(DEFAULT_PERSONA), limit=2000)
+ # offline_human_block = Block(name="human", label="human", value=get_human_text(DEFAULT_HUMAN), limit=2000)
+ # offline_persona_block = Block(name="persona", label="persona", value=get_persona_text("offline_memory_persona"), limit=2000)
+
+ ## Figure 1. from Evaluating the Ripple Effects of Knowledge Editing in Language Models (Cohen et al., 2023)
+ ## https://arxiv.org/pdf/2307.12976
+ # fact_block = Block(
+ # name="fact_block",
+ # label="fact_block",
+ # value="""Messi resides in the Paris.
+ # Messi plays in the league Ligue 1.
+ # Messi plays for the team Paris Saint-Germain.
+ # The national team Messi plays for is the Argentina team.
+ # Messi is also known as Leo Messi
+ # Victor Ulloa plays for Inter Miami""",
+ # limit=2000,
+ # )
+ # new_memory = Block(name="rethink_memory_block", label="rethink_memory_block", value="[empty]", limit=2000)
conversation_memory = BasicBlockMemory(blocks=[conversation_persona_block, conversation_human_block, fact_block, new_memory])
offline_memory = BasicBlockMemory(blocks=[offline_persona_block, offline_human_block, fact_block, new_memory])
@@ -107,10 +126,13 @@ def test_chat_only_agent(client, mock_e2b_api_key_none):
rethink_memory = client.create_or_update_tool(rethink_memory_convo)
finish_rethinking_memory = client.create_or_update_tool(finish_rethinking_memory_convo)
- conversation_human_block = Block(name="chat_agent_human", label="chat_agent_human", value=get_human_text(DEFAULT_HUMAN), limit=2000)
- conversation_persona_block = Block(
- name="chat_agent_persona", label="chat_agent_persona", value=get_persona_text(DEFAULT_PERSONA), limit=2000
- )
+ # conversation_human_block = Block(name="chat_agent_human", label="chat_agent_human", value=get_human_text(DEFAULT_HUMAN), limit=2000)
+ # conversation_persona_block = Block(
+ # name="chat_agent_persona", label="chat_agent_persona", value=get_persona_text(DEFAULT_PERSONA), limit=2000
+ # )
+
+ conversation_human_block = client.create_block(label="chat_agent_human", value=get_human_text(DEFAULT_HUMAN), limit=2000)
+ conversation_persona_block = client.create_block(label="chat_agent_persona", value=get_persona_text(DEFAULT_PERSONA), limit=2000)
conversation_memory = BasicBlockMemory(blocks=[conversation_persona_block, conversation_human_block])
send_message = client.server.tool_manager.get_tool_by_name(tool_name="send_message", actor=client.user)