AgentsOpen SourceFreeActiveMachine-verified· intermediate · ~10 min setup

Letta: An Agent That Manages Its Own Memory

Install the Letta CLI and SDK, the MemGPT lineage where the agent edits its own memory blocks like an OS pages memory.

by Shilpa Mitra· verified today· v1.0.0

Run this workflow

CI-verified, 3/3 fixtures passing.

Build this with your agent

One copy-paste hands Claude Code, Codex, or Cursor the full recipe, steps included, nothing to fetch.

Intended Use

Long-running agents that should manage their own context: Letta agents edit their own memory blocks, paging in and out what matters. CI installs the letta-code CLI from npm (checking the binary lands and reports its version) and the Python SDK from PyPI (checking it imports). Creating an agent and exchanging messages runs against a model, so that's fenced.

Not for

  • One-shot scripts, Letta's value is stateful agents that persist
  • Expecting CI to verify agent conversations, those need a model and your key

The Stack

Tested Against

@letta-ai/letta-code@latestletta-client@latestnode@20.xpython@3.12

Side effects & data flow

Network
npm + PyPI, install only
Writes
./node_modules/, ./.venv/
Credentials
Model key, for the fenced agent steps only

Prerequisites

  • Node 20+ (CLI)
  • Python 3.10+ (SDK)
  • A model key for the fenced agent steps

Steps

  1. 1

    Install the CLI and the SDK, verify both land

    The fastest start is the letta-code CLI from npm; for building it into an app there's a Python SDK. CI installs both into an isolated dir and venv, checks the CLI binary lands with a readable version, and that the SDK imports. No key.

    npm install --no-fund --no-audit @letta-ai/letta-code >/dev/null 2>&1
    test -e node_modules/.bin/letta || { echo "letta CLI binary missing"; exit 1; }
    echo "letta CLI installed: v$(node -p "require('./node_modules/@letta-ai/letta-code/package.json').version")"
    python3 -m venv .venv
    .venv/bin/pip install -q letta-client
    .venv/bin/python - <<'EOF'
    import letta_client
    print("letta SDK imports OK")
    EOF
  2. 2

    Run the agent (the model step, not checked by CI)

    Run `letta` to start the CLI agent, or create one from the SDK and exchange messages. Both run against a model, so CI never claims them.

Eval, 3 fixtures

Last passed: verified today
  • cli-installedcontainstimeout 600s · max $0

    Expected: letta CLI installed: v

  • sdk-importscontainstimeout 600s · max $0

    Expected: letta SDK imports OK

  • clean-exitexit_codetimeout 600s · max $0

    Expected: 0

Results

Formerly MemGPT; the pick for long-running agents that should improve over time.

Did this work for you?

Our CI checks the setup runs. You tell us if the whole thing worked. Tell us straight.

Liked this workflow?

Get new verified workflows in WebAfterAI, three issues a week (Tue, Thu, Sat).