Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/just-cameron/note. External storage tool for Letta agents to manage persistent notes
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879#!/bin/bash## Install the Letta Note tool# Usage: curl -sSL https://raw.githubusercontent.com/cpfiffer/note/main/install.sh | bash#
set -e
echo "Letta Note Tool Installer"echo "========================="echo ""
# Get API keyAPI_KEY="${LETTA_API_KEY:-}"
if [ -z "$API_KEY" ]; then read -p "Enter your Letta API key: " API_KEY echo ""fi
if [ -z "$API_KEY" ]; then echo "Error: API key required" exit 1fi
echo "Checking for existing 'note' tool..."EXISTING=$(curl -sS "https://api.letta.com/v1/tools/?name=note" \ -H "Authorization: Bearer $API_KEY")
if echo "$EXISTING" | grep -q '"id"'; then EXISTING_ID=$(echo "$EXISTING" | python3 -c 'import json,sys; d=json.loads(sys.stdin.read()); print(d[0]["id"] if d else "")') if [ -n "$EXISTING_ID" ]; then echo "" echo "Warning: A tool named 'note' already exists (ID: $EXISTING_ID)" read -p "Overwrite it? [y/N] " CONFIRM if [ "$CONFIRM" != "y" ] && [ "$CONFIRM" != "Y" ]; then echo "Aborted." exit 0 fi echo "" fifi
echo "Fetching note_tool.py..."SOURCE_CODE=$(curl -sSL https://raw.githubusercontent.com/cpfiffer/note/main/note_tool.py)
if [ -z "$SOURCE_CODE" ]; then echo "Error: Failed to fetch note_tool.py" exit 1fi
echo "Installing tool..."
# Escape for JSONSOURCE_CODE_JSON=$(echo "$SOURCE_CODE" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')
# Upsert the toolRESPONSE=$(curl -sS https://api.letta.com/v1/tools/ \ -X PUT \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d "{\"source_code\": $SOURCE_CODE_JSON}")
# Check for errorsif echo "$RESPONSE" | grep -q '"error"'; then echo "Error: $RESPONSE" exit 1fi
TOOL_ID=$(echo "$RESPONSE" | python3 -c 'import json,sys; print(json.loads(sys.stdin.read()).get("id", "unknown"))')
echo ""echo "✓ Note tool installed!"echo ""echo "Tool ID: $TOOL_ID"echo ""echo "Next: Attach to your agent via ADE or SDK:"echo " client.agents.tools.attach(agent_id=AGENT_ID, tool_id=\"$TOOL_ID\")"