a tool to help your Letta AI agents navigate bluesky
1"""
2Example Bluesky Tool for Letta Agent
3
4This is a template showing the expected format for Letta tools.
5Replace this with your actual Bluesky tools.
6"""
7
8import os
9from typing import Optional
10
11
12def example_bluesky_tool(message: str, user_handle: Optional[str] = None) -> str:
13 """
14 Example tool demonstrating the expected format for Bluesky integrations.
15
16 This tool shows how to:
17 - Access environment variables (BSKY_USERNAME, BSKY_APP_PASSWORD, etc.)
18 - Use proper Google-style docstrings
19 - Include type annotations
20 - Return meaningful results
21
22 Args:
23 message: The message content to process
24 user_handle: Optional Bluesky user handle (e.g., "@username.bsky.social")
25
26 Returns:
27 str: A confirmation message or result from the operation
28
29 Example:
30 >>> example_bluesky_tool("Hello world", "@alice.bsky.social")
31 "Processed message for @alice.bsky.social: Hello world"
32 """
33 # Access environment variables set by mount()
34 bsky_username = os.getenv("BSKY_USERNAME")
35 BSKY_APP_PASSWORD = os.getenv("BSKY_APP_PASSWORD")
36 bsky_service_url = os.getenv("BSKY_SERVICE_URL", "https://bsky.social")
37
38 # Your tool implementation here
39 # This is just an example - replace with actual Bluesky API calls
40
41 if not bsky_username or not BSKY_APP_PASSWORD:
42 return "Error: Bluesky credentials not configured"
43
44 target = user_handle or "the timeline"
45 return f"Processed message for {target}: {message}"