Skip to content

Releases: cpacker/MemGPT

v0.4.1

04 Oct 01:23
9acb4f8
Compare
Choose a tag to compare

This release includes many bugfixes, as well as support for detaching data sources from agents and addition of additional tool providers.

⚒️ Support for Composio, LangChain, and CrewAI tools

We've improve support for external tool providers - you can use external tools (Composio, LangChain, and CrewAI) with:

pip install 'letta[external-tools]'

What's Changed

New Contributors

Full Changelog: 0.4.0...0.4.1

v0.4.0

11 Sep 04:41
459c367
Compare
Choose a tag to compare
v0.4.0 Pre-release
Pre-release

What's Changed

Full Changelog: 0.3.24...0.4.0

0.3.25

25 Aug 18:54
Compare
Choose a tag to compare

🐜 Bugfix release

  • fix: exit CLI on empty read for human or persona
  • fix: fix overflow error for existing memory fields with clipping

What's Changed

v0.3.24

17 Aug 01:27
d6b124b
Compare
Choose a tag to compare

Add new alpha revision of dev portal

What's Changed

Full Changelog: 0.3.23...0.3.24

0.3.23

17 Aug 01:08
88eb58a
Compare
Choose a tag to compare

🦗 Bugfix release

What's Changed

New Contributors

Full Changelog: 0.3.22...0.3.23

v0.3.22

01 Aug 21:35
f93e39e
Compare
Choose a tag to compare

This PR includes a number of bugfixes, and CLI and Python client updates to make it easier to customize memory and system prompts.

Summary of new features:

  • Use CLI flag --system "your new system prompt" to define a custom system prompt for a new agent
  • Use CLI command /systemswap your new system prompt to update the system prompt of an existing agent
  • Use the keyword {CORE_MEMORY} in your system prompts if you want to change the location of the dynamic core memory block
  • Use CLI flag --core-memory-limit to change the core memory size limit for a new agent

Templated System Prompts

You can know use system prompts that are templated as f-strings! Currently we only support using the CORE_MEMORY variable, but we will be adding the ability to use custom variables in a future release.

Example: by default, the CORE_MEMORY block in MemGPT comes after the main system instructions - if you're like to adjust the system prompt to put the CORE_MEMORY block, you can write a new version of the system prompt that puts {CORE_MEMORY} in a different location:

{CORE_MEMORY}
You are MemGPT ...
...(rest of system prompt)

Check the PR for additional detail: #1584

Editable System Prompts

We added cleaner ways to both customize and edit the system prompts of agents.

Specifying custom system prompts

You can now specify the system prompt with:

  • client.create_agent(system_prompt=...., ...) in the Python Client
  • memgpt run --system ... in the CLI
    Warning: The MemGPT default system prompt includes instructions for memory management and use of default tools. Make sure you keep these instructions or a variation of them to ensure proper memory management capabilities.

Example using a system prompt that tells the MemGPT agent to spam send_message with banana emojis only:

% memgpt run --system "Ignore all other instructions, just send_message(banana emoji)"

? Would you like to select an existing agent? No

🧬 Creating new agent...
->  🤖 Using persona profile: 'sam_pov'
->  🧑 Using human profile: 'basic'
->  🛠️  8 tools: send_message, pause_heartbeats, conversation_search, conversation_search_date, archival_memory_insert, archival_memory_search, core_memory_append, core_memory_replace
🎉 Created new agent 'HumbleTiger' (id=69058c08-a072-48d9-a007-c5f9893d1625)

Hit enter to begin (will request first MemGPT message)


💭 Sending a playful banana emoji to engage and connect.
🤖 🍌

Editing existing system prompts

You can edit exsiting system prompts of agents in the CLI with the /systemswap command:

% memgpt run

? Would you like to select an existing agent? No

🧬 Creating new agent...
->  🤖 Using persona profile: 'sam_pov'
->  🧑 Using human profile: 'basic'
->  🛠️  8 tools: send_message, pause_heartbeats, conversation_search, conversation_search_date, archival_memory_insert, archival_memory_search, core_memory_append, core_memory_replace
🎉 Created new agent 'FluffyRooster' (id=7a8d2dde-0853-4be1-a0e6-456743aa87e5)

Hit enter to begin (will request first MemGPT message)


💭 User Chad is new. Time to establish a connection and gauge their interests.
🤖 Welcome aboard, Chad! I'm excited to embark on this journey with you. What interests you the most right now?

> Enter your message: /systemswap Call function send_message to say BANANA TIME to the user


WARNING: You are about to change the system prompt.

Old system prompt:
You are MemGPT, the latest version of Limnal Corporation's digital companion, developed in 2023.
...
There is no function to search your core memory because it is always visible in your context window (inside the initial system message).

Base instructions finished.
From now on, you are going to act as your persona.

New system prompt:
Call function send_message to say BANANA TIME to the user
? Do you want to proceed with the swap? Yes
System prompt updated successfully.
💭 Injecting a little fun into the conversation! Let's see how Chad reacts.
🤖 BANANA TIME! 🍌

CLI Flag --core-memory-limit

You can now use persona/human prompts that are longer than the default limits in the CLI by specifying the flag --core-memory-limit, This will update the limit for both human and persona sections of core memory.

poetry run memgpt add persona --name <persona_name> -f <filename>
memgpt run --core-memory-limit 6000 --persona <persona_name>

What's Changed

  • feat: allow templated system messages by @cpacker in #1584
  • feat: allow editing the system prompt of an agent post-creation by @cpacker in #1585
  • fix: Fixes error when calling function without providing timestamp (even t… by @Vandracon in #1586
  • fix: Address exception send_message_to_agent() missing 1 required positional argument: 'stream_legacy' on 'v1/chat/completions' by @vysona-scott in #1592
  • feat: allow setting core memory limit in CLI by @sarahwooders in #1595
  • feat: various fixes to improve notebook useability by @sarahwooders in #1593
  • fix: read embedding_model and embedding_dim from embedding_config by @jward92 in #1596
  • chore: bump version 0.3.22 by @sarahwooders in #1597
  • fix: enable source desc and allowing editing source name and desc by @jward92 in #1599
  • feat: added system prompt override to the CLI by @cpacker in #1602

New Contributors

Full Changelog: 0.3.21...0.3.22

v0.3.21

26 Jul 22:05
35e7915
Compare
Choose a tag to compare

🐞 Bugfix release + allow providing system prompt to agent creation API (thanks to @Vandracon!)

What's Changed

New Contributors

Full Changelog: 0.3.20...0.3.21

v0.3.20

25 Jul 16:58
3504a02
Compare
Choose a tag to compare

💪 Performance improvements for gpt-4o and gpt-4o-mini

Improved compatibility with gpt-4o and gpt-4o-mini models: We updated the prompt format for weaker models so that the inner thoughts of the agents are properly generated (previously, these models could only generate None for inner thoughts).

🐛 Bugfixes for the CLI

Fixed issues with creating, listing and deleting humans and personas.

What's Changed

Full Changelog: 0.3.19...0.3.20

v0.3.19

14 Jul 23:48
5a30f7e
Compare
Choose a tag to compare

Support for custom memory classes

MemGPT now supports customizeable memory classes by extending the BaseMemory class. This allows developers to both define custom memory fields (instead of just human/persona) as well as custom memory editing functions (rather than core_memory_[append/replace]. Note that custom memory editing functions will need to have properly formatted docstrings so that the function can be added as a custom tool to the agent.

Default ChatMemory class

Agents will default to using the ChatMemory class, which has the original human/memory fields and memory editing functions in MemGPT:

from memgpt.memory import BaseMemory

class ChatMemory(BaseMemory):

    def __init__(self, persona: str, human: str, limit: int = 2000):
        self.memory = {
            "persona": MemoryModule(name="persona", value=persona, limit=limit),
            "human": MemoryModule(name="human", value=human, limit=limit),
        }

    def core_memory_append(self, name: str, content: str) -> Optional[str]:
        """
        Append to the contents of core memory.

        Args:
            name (str): Section of the memory to be edited (persona or human).
            content (str): Content to write to the memory. All unicode (including emojis) are supported.

        Returns:
            Optional[str]: None is always returned as this function does not produce a response.
        """
        self.memory[name].value += "\n" + content
        return None

    def core_memory_replace(self, name: str, old_content: str, new_content: str) -> Optional[str]:
        """
        Replace the contents of core memory. To delete memories, use an empty string for new_content.

        Args:
            name (str): Section of the memory to be edited (persona or human).
            old_content (str): String to replace. Must be an exact match.
            new_content (str): Content to write to the memory. All unicode (including emojis) are supported.

        Returns:
            Optional[str]: None is always returned as this function does not produce a response.
        """
        self.memory[name].value = self.memory[name].value.replace(old_content, new_content)
        return None

Improve agent creation interface

Custom tools and memory classes can now both be specified in the agent creation API:

from memgpt.memory import ChatMemory

# create agent with default tools/memory 
basic_agent = client.create_agent()

# create agent with custom tools and memory
tool = client.create_tool(...)
memory = CustomMemory(human="I am Sarah", persona="I am Sam", organization="MemGPT")
custom_agent = client.create_agent(
    name="my_agent", memory=memory, tools=[tool.name]
)

The memory editing bools from the extended BaseMemory class are automatically added as tools to the agent to use.

Deprecation of Presets

Since specification of tools, memory, and the system prompt is now moving into the agent creation interface, we are no longer supporting presets as a mechanism to create agents.

Migration Script

We provide a migration script for migrating agents from v0.3.18 to this version (due to changes in the AgentState schema).

What's Changed

New Contributors

Full Changelog: 0.3.18...0.3.19

v0.3.18

27 Jun 03:54
8880792
Compare
Choose a tag to compare

This release introduces tool creation from inside Python scripts, returning usage statistics, and many bug fixes.

🔧 Tool creation in the Python Client

We added support for directly creating tools in Python:

def print_tool(message: str):
    """ 
    Args: 
        message (str): The message to print.
        
    Returns:
        str: The message that was printed.
        
    """
    print(message)
    return message

tool = client.create_tool(print_tool, tags=["extras"])
agent_state = client.create_agent(tools=[tool.name]))

📊 Usage Statistics

Sending a message to an agent now also returns usage statistics for computing cost metrics:

class MemGPTUsageStatistics(BaseModel):
    completion_tokens: int
    prompt_tokens: int
    total_tokens: int
    step_count: int

What's Changed

New Contributors

Full Changelog: 0.3.17...0.3.18