+88
tools/README.md
+88
tools/README.md
···
1
+
# Letta Agent Tools
2
+
3
+
This directory contains Python tools for the Letta agent to interact with Bluesky.
4
+
5
+
## Directory Structure
6
+
7
+
```
8
+
tools/
9
+
├── bluesky/ # Bluesky-specific tools
10
+
│ ├── *.py # Your tool files go here
11
+
│ └── example_tool.py # Sample showing expected format
12
+
└── README.md # This file
13
+
```
14
+
15
+
## Adding Your Existing Tools
16
+
17
+
1. **Copy your Python tool files** into the `tools/bluesky/` directory
18
+
2. **Ensure each file contains ONE tool function** as the main export
19
+
3. **Tool naming convention**: The filename should match the function name
20
+
- Example: `create_bluesky_post.py` contains `def create_bluesky_post(...)`
21
+
22
+
## Required Tools for Bluesky
23
+
24
+
Based on your operational guide, these tools are referenced:
25
+
26
+
- `create_bluesky_post` - Creates posts or replies on Bluesky
27
+
- `like_bluesky_post` - Likes a specific post
28
+
- `repost_bluesky_post` - Reposts content to followers
29
+
- `quote_bluesky_post` - Quotes a post with commentary
30
+
- `update_bluesky_connection` - Follow/unfollow/block/mute operations
31
+
- `fetch_bluesky_posts` - Retrieves posts from feeds
32
+
- `get_bluesky_user_info` - Gets user profile information
33
+
- `update_bluesky_profile` - Updates the agent's profile
34
+
- `ignore_notification` - (May be handled by Letta core, not custom)
35
+
36
+
## Tool Format Requirements
37
+
38
+
Each Python tool file must:
39
+
40
+
1. **Use Google-style docstrings** with:
41
+
- Brief description
42
+
- `Args:` section documenting all parameters
43
+
- `Returns:` section describing the return value
44
+
- Optional `Example:` section
45
+
46
+
2. **Include type annotations** for all parameters and return values
47
+
48
+
3. **Access environment variables** for credentials:
49
+
```python
50
+
import os
51
+
username = os.getenv("BSKY_USERNAME")
52
+
password = os.getenv("BSKY_APP_PASSWORD")
53
+
service_url = os.getenv("BSKY_SERVICE_URL")
54
+
```
55
+
56
+
4. **Return meaningful results** (strings, JSON, or structured data)
57
+
58
+
See `tools/bluesky/example_tool.py` for a complete example.
59
+
60
+
## How It Works
61
+
62
+
When you run `deno task prep-agent`, the script will:
63
+
64
+
1. Check which tools are already attached to your agent
65
+
2. Search for tools in Letta's global tool registry
66
+
3. For missing tools, read the `.py` file from `tools/bluesky/`
67
+
4. Create the tool in Letta
68
+
5. Attach the tool to your agent
69
+
70
+
## After Adding Tools
71
+
72
+
Once you've copied your tool files into `tools/bluesky/`:
73
+
74
+
```bash
75
+
deno task prep-agent
76
+
```
77
+
78
+
This will automatically create and attach all tools to your agent.
79
+
80
+
## Updating Tools
81
+
82
+
If you modify a tool:
83
+
84
+
1. Update the `.py` file in `tools/bluesky/`
85
+
2. Delete the old tool from Letta (via UI or API)
86
+
3. Run `deno task prep-agent` to recreate it
87
+
88
+
Alternatively, use Letta's `client.tools.modify()` API to update existing tools.