···124 # Get thread context as YAML string
125 thread_context = thread_to_yaml_string(thread)
126127- print(thread_context)
128-129 # Create a prompt for the Letta agent with thread context
130 prompt = f"""You received a mention on Bluesky from @{author_handle} ({author_name or author_handle}).
131···145- reply_to_cid: {cid}"""
146147 # Get response from Letta agent
148- logger.info(f"Generating reply for mention from @{author_handle}")
149 logger.debug(f"Prompt being sent: {prompt}")
150151 try:
···160 logger.error(f"Mention text was: {mention_text}")
161 logger.error(f"Author: @{author_handle}")
162 logger.error(f"URI: {uri}")
163-164 # Check for specific error types
165 if hasattr(api_error, 'status_code'):
166 logger.error(f"API Status code: {api_error.status_code}")
167 if api_error.status_code == 524:
168 logger.error("524 error - timeout from Cloudflare, will retry later")
169 return False # Keep in queue for retry
170-171 # Check if error indicates we should remove from queue
172 if 'status_code: 524' in error_str:
173 logger.warning("524 timeout error, keeping in queue for retry")
174 return False # Keep in queue for retry
175-176 raise
177178 # Extract the reply text from the agent's response
···124 # Get thread context as YAML string
125 thread_context = thread_to_yaml_string(thread)
12600127 # Create a prompt for the Letta agent with thread context
128 prompt = f"""You received a mention on Bluesky from @{author_handle} ({author_name or author_handle}).
129···143- reply_to_cid: {cid}"""
144145 # Get response from Letta agent
146+ logger.info(f"@{author_handle}: {mention_text}")
147 logger.debug(f"Prompt being sent: {prompt}")
148149 try:
···158 logger.error(f"Mention text was: {mention_text}")
159 logger.error(f"Author: @{author_handle}")
160 logger.error(f"URI: {uri}")
161+162 # Check for specific error types
163 if hasattr(api_error, 'status_code'):
164 logger.error(f"API Status code: {api_error.status_code}")
165 if api_error.status_code == 524:
166 logger.error("524 error - timeout from Cloudflare, will retry later")
167 return False # Keep in queue for retry
168+169 # Check if error indicates we should remove from queue
170 if 'status_code: 524' in error_str:
171 logger.warning("524 timeout error, keeping in queue for retry")
172 return False # Keep in queue for retry
173+174 raise
175176 # Extract the reply text from the agent's response