···124124 # Get thread context as YAML string
125125 thread_context = thread_to_yaml_string(thread)
126126127127- print(thread_context)
128128-129127 # Create a prompt for the Letta agent with thread context
130128 prompt = f"""You received a mention on Bluesky from @{author_handle} ({author_name or author_handle}).
131129···145143- reply_to_cid: {cid}"""
146144147145 # Get response from Letta agent
148148- logger.info(f"Generating reply for mention from @{author_handle}")
146146+ logger.info(f"@{author_handle}: {mention_text}")
149147 logger.debug(f"Prompt being sent: {prompt}")
150148151149 try:
···160158 logger.error(f"Mention text was: {mention_text}")
161159 logger.error(f"Author: @{author_handle}")
162160 logger.error(f"URI: {uri}")
163163-161161+164162 # Check for specific error types
165163 if hasattr(api_error, 'status_code'):
166164 logger.error(f"API Status code: {api_error.status_code}")
167165 if api_error.status_code == 524:
168166 logger.error("524 error - timeout from Cloudflare, will retry later")
169167 return False # Keep in queue for retry
170170-168168+171169 # Check if error indicates we should remove from queue
172170 if 'status_code: 524' in error_str:
173171 logger.warning("524 timeout error, keeping in queue for retry")
174172 return False # Keep in queue for retry
175175-173173+176174 raise
177175178176 # Extract the reply text from the agent's response